From: Wei Yongjun Date: Sun, 21 May 2017 01:19:39 +0000 (+0000) Subject: drm/vgem: Fix return value check in vgem_init() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e8fa49b5d974846d367b103edc026c4d2b90ebfd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/vgem: Fix return value check in vgem_init() 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: af33a9190d02 ("drm/vgem: Enable dmabuf import interfaces") Signed-off-by: Wei Yongjun Reviewed-by: Chris Wilson [danvet: Fix fixes: tag per Chris' review.] Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20170521011939.8111-1-weiyj.lk@gmail.com --- diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 54ec94c5e9ac..18f401b442c2 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -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; }