diff mbox

drm/imx: drm_dev_alloc() returns error pointers

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

Commit Message

Dan Carpenter Oct. 13, 2016, 8:53 a.m. UTC
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>

Comments

Lucas Stach Oct. 13, 2016, 12:40 p.m. UTC | #1
Am Donnerstag, den 13.10.2016, 11:53 +0300 schrieb Dan Carpenter:
> 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>

> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c
> b/drivers/gpu/drm/imx/imx-drm-core.c
> index 98df09c..3acc976 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -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) {
Philipp Zabel Oct. 17, 2016, 4:10 p.m. UTC | #2
Am Donnerstag, den 13.10.2016, 11:53 +0300 schrieb Dan Carpenter:
> 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>
> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 98df09c..3acc976 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -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) {

Applied, thanks.

regards
Philipp
diff mbox

Patch

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 98df09c..3acc976 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -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) {