drm: mxsfb: drm_dev_alloc() returns error pointers
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 13 Dec 2016 12:23:32 +0000 (15:23 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 13 Dec 2016 21:24:20 +0000 (22:24 +0100)
We should be checking for IS_ERR() instead of NULL because
drm_dev_alloc() returns error pointers.

Fixes: 45d59d704080 ("drm: Add new driver for MXSFB controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161213122332.GA7519@elgon.mountain
drivers/gpu/drm/mxsfb/mxsfb_drv.c

index 79a18bf..955441f 100644 (file)
@@ -395,8 +395,8 @@ static int mxsfb_probe(struct platform_device *pdev)
                pdev->id_entry = of_id->data;
 
        drm = drm_dev_alloc(&mxsfb_driver, &pdev->dev);
-       if (!drm)
-               return -ENOMEM;
+       if (IS_ERR(drm))
+               return PTR_ERR(drm);
 
        ret = mxsfb_load(drm, 0);
        if (ret)