linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/imx: Fix error handling
@ 2016-10-31 17:59 Christophe JAILLET
  2016-11-01  9:07 ` Philipp Zabel
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2016-10-31 17:59 UTC (permalink / raw)
  To: p.zabel, airlied
  Cc: dri-devel, linux-kernel, kernel-janitors, Christophe JAILLET

'drm_dev_alloc()' returns an error pointer in case of error, not NULL
So test it with IS_ERR.

This behavior has been introduced recently in	0f2886057be3. For some
reason, this file has not been updated.

Fixes: 0f2886057be3 ("drm: Don't swallow error codes in drm_dev_alloc()")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 98df09c2b388..3acc976cc04e 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) {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/imx: Fix error handling
  2016-10-31 17:59 [PATCH] drm/imx: Fix error handling Christophe JAILLET
@ 2016-11-01  9:07 ` Philipp Zabel
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Zabel @ 2016-11-01  9:07 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: airlied, dri-devel, linux-kernel, kernel-janitors, Dan Carpenter

Hi Christophe,

Am Montag, den 31.10.2016, 18:59 +0100 schrieb Christophe JAILLET:
> 'drm_dev_alloc()' returns an error pointer in case of error, not NULL
> So test it with IS_ERR.
> 
> This behavior has been introduced recently in	0f2886057be3. For some
> reason, this file has not been updated.
> 
> Fixes: 0f2886057be3 ("drm: Don't swallow error codes in drm_dev_alloc()")
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/gpu/drm/imx/imx-drm-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 98df09c2b388..3acc976cc04e 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) {

Thank you for the patch. The same fix is in the queue already:
8cca354816ad ("drm/imx: drm_dev_alloc() returns error pointers"). Only
Dan selected commit 54db5decce17 ("drm/imx: drop deprecated load/unload
drm_driver ops") as the culprit.

regards
Philipp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-01  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-31 17:59 [PATCH] drm/imx: Fix error handling Christophe JAILLET
2016-11-01  9:07 ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).