diff mbox

drm: zte: checking for NULL instead of IS_ERR()

Message ID 20161115095301.GC15424@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Nov. 15, 2016, 9:53 a.m. UTC
drm_dev_alloc() never returns NULL, it only returns error pointers on
error.

Fixes: 0a886f59528a ("drm: zte: add initial vou drm driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Daniel Vetter Nov. 15, 2016, 10 a.m. UTC | #1
On Tue, Nov 15, 2016 at 12:53:01PM +0300, Dan Carpenter wrote:
> drm_dev_alloc() never returns NULL, it only returns error pointers on
> error.
> 
> Fixes: 0a886f59528a ("drm: zte: add initial vou drm driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thx.
-Daniel

> 
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index abc8099..3e76f72 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -107,8 +107,8 @@ static int zx_drm_bind(struct device *dev)
>  		return -ENOMEM;
>  
>  	drm = drm_dev_alloc(&zx_drm_driver, dev);
> -	if (!drm)
> -		return -ENOMEM;
> +	if (IS_ERR(drm))
> +		return PTR_ERR(drm);
>  
>  	drm->dev_private = priv;
>  	dev_set_drvdata(dev, drm);
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index abc8099..3e76f72 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -107,8 +107,8 @@  static int zx_drm_bind(struct device *dev)
 		return -ENOMEM;
 
 	drm = drm_dev_alloc(&zx_drm_driver, dev);
-	if (!drm)
-		return -ENOMEM;
+	if (IS_ERR(drm))
+		return PTR_ERR(drm);
 
 	drm->dev_private = priv;
 	dev_set_drvdata(dev, drm);