Skip to contentSkip to conversation

drm/vboxvideo: Fix a NULL vs IS_ERR() check in vbox_hw_init()

PATCH New Wei Yongjun 1 participant 1 message Apr 30, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vboxvideo: Fix a NULL vs IS_ERR() check in vbox_hw_init()

The devm_gen_pool_create() function returns ERR_PTR() on error, it doesn't return NULL so this check doesn't work.

Fixes 4cc9b565454b ("drm/vboxvideo: Use devm_gen_pool_create")
---
 drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vboxvideo/vbox_main.c +2 -2
index d68d9bad7674..c5ea880d17b2 100644
@@ -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,