Skip to contentSkip to conversation

drm/vgem: Fix return value check in vgem_init()

PATCH Applied Wei Yongjun 3 participants 3 messages May 21, 2017 – May 22, 2017

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

PATCH 1/1 drm/vgem: Fix return value check in vgem_init()

From: Wei Yongjun <[email protected]>

In case of error, the function platform_device_register_simple() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes 315f0242aa2b ("drm/vgem: Convert to a struct drm_device subclass")
---
 drivers/gpu/drm/vgem/vgem_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vgem/vgem_drv.c +2 -2
index 54ec94c..18f401b 100644
@@ -438,8 +438,8 @@ static int __init vgem_init(void)
 
 	vgem_device->platform =
 		platform_device_register_simple("vgem", -1, NULL, 0);
-	if (!vgem_device->platform) {
-		ret = -ENODEV;
+	if (IS_ERR(vgem_device->platform)) {
+		ret = PTR_ERR(vgem_device->platform);
 		goto out_fini;
 	}
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function platform_device_register_simple() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Fixes 315f0242aa2b ("drm/vgem: Convert to a struct drm_device subclass")

This is wrong, the bug was introduced in af33a9190d02 ("drm/vgem: Enable dmabuf import interfaces") not that it matters since it is the same tag.

Quoted 1 line

Checked it is an ERR_PTR return on failure, so

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 7 lines · Chris Wilson
Quoted 6 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function platform_device_register_simple() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Quoted 5 lines
Quoted 1 line
Fixes 315f0242aa2b ("drm/vgem: Convert to a struct drm_device subclass")

This is wrong, the bug was introduced in af33a9190d02 ("drm/vgem: Enable dmabuf import interfaces") not that it matters since it is the same tag.

Fixed.

Quoted 4 lines
Quoted 1 line

Checked it is an ERR_PTR return on failure, so

Applied, thanks for patch&review.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel