diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-07-19 10:45:02 +0200 |
---|---|---|
committer | Sui Jingfeng <sui.jingfeng@linux.dev> | 2023-08-04 07:31:32 +0200 |
commit | b0e9267d4ccce9be9217337f4bc364ca24cf7f73 (patch) | |
tree | 99d3ca92eda9a2e80cb59a86f6647a5e8e113c8d | |
parent | drm/doc: fix underline for section "DRM Sync Objects" (diff) | |
download | linux-b0e9267d4ccce9be9217337f4bc364ca24cf7f73.tar.xz linux-b0e9267d4ccce9be9217337f4bc364ca24cf7f73.zip |
drm/loongson: Add a check for lsdc_bo_create() errors
This code doesn't check for lsdc_bo_create() failure and it could lead
to a crash. It can fail for a variety of reasons, but the most common
cause would be low memory. Add a check.
Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Link: https://patchwork.freedesktop.org/patch/msgid/ZLeijglIMPve2Iio@kadam
-rw-r--r-- | drivers/gpu/drm/loongson/lsdc_ttm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/loongson/lsdc_ttm.c b/drivers/gpu/drm/loongson/lsdc_ttm.c index bb0c8fd43a75..bf79dc55afa4 100644 --- a/drivers/gpu/drm/loongson/lsdc_ttm.c +++ b/drivers/gpu/drm/loongson/lsdc_ttm.c @@ -496,6 +496,8 @@ struct lsdc_bo *lsdc_bo_create_kernel_pinned(struct drm_device *ddev, int ret; lbo = lsdc_bo_create(ddev, domain, size, true, NULL, NULL); + if (IS_ERR(lbo)) + return ERR_CAST(lbo); ret = lsdc_bo_reserve(lbo); if (unlikely(ret)) { |