drm/imx: drm_dev_alloc() returns error pointers
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 13 Oct 2016 08:53:21 +0000 (11:53 +0300)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 18 Oct 2016 09:02:11 +0000 (11:02 +0200)
We are checking for NULL here, when we should be checking for error
pointers.

Fixes: 54db5decce17 ("drm/imx: drop deprecated load/unload drm_driver ops")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/drm/imx/imx-drm-core.c

index b084c571b23f74d909f150c9352d3174379089ac..9672b579f9506942fa1a697b4708737edc8ad7a0 100644 (file)
@@ -357,8 +357,8 @@ static int imx_drm_bind(struct device *dev)
        int ret;
 
        drm = drm_dev_alloc(&imx_drm_driver, dev);
-       if (!drm)
-               return -ENOMEM;
+       if (IS_ERR(drm))
+               return PTR_ERR(drm);
 
        imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL);
        if (!imxdrm) {