[PATCH] drm/vboxvideo: Fix return check for devm_gen_pool_create()
zhangxiaoxu
zhangxiaoxu5 at huawei.com
Mon Nov 9 14:38:57 UTC 2020
devm_gen_pool_create() returns a valid pointer on success or ERR_PTR
on failure which should be checked with IS_ERR. Also use PTR_ERR for
returning error codes.
Fixes: 4cc9b565454b ("drm/vboxvideo: Use devm_gen_pool_create")
Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: zhangxiaoxu <zhangxiaoxu5 at huawei.com>
---
drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c
index d68d9bad7674..c5ea880d17b2 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_main.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_main.c
@@ -123,8 +123,8 @@ int vbox_hw_init(struct vbox_private *vbox)
/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1,
"vboxvideo-accel");
- if (!vbox->guest_pool)
- return -ENOMEM;
+ if (IS_ERR(vbox->guest_pool))
+ return PTR_ERR(vbox->guest_pool);
ret = gen_pool_add_virt(vbox->guest_pool,
(unsigned long)vbox->guest_heap,
--
2.25.4
More information about the dri-devel
mailing list