public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: return ERR_PTR instead of NULL
@ 2016-11-10 21:10 Julia Lawall
  2016-11-11  1:45 ` Mark yao
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2016-11-10 21:10 UTC (permalink / raw)
  To: Mark Yao
  Cc: kernel-janitors, David Airlie, Heiko Stuebner, dri-devel,
	linux-arm-kernel, linux-rockchip, linux-kernel,
	Christophe JAILLET

rockchip_drm_framebuffer_init is only used in one case, in
rockchip_drm_fbdev.c, where its return value is tested using IS_ERR.  To
enable propagating the reason for the error, change the definition so that
it returns an ERR_PTR value.

Problem found with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index 0f6eda0..01e11bf 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -213,7 +213,7 @@ struct drm_framebuffer *
 
 	rockchip_fb = rockchip_fb_alloc(dev, mode_cmd, &obj, 1);
 	if (IS_ERR(rockchip_fb))
-		return NULL;
+		return ERR_CAST(rockchip_fb);
 
 	return &rockchip_fb->fb;
 }


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

* Re: [PATCH] drm/rockchip: return ERR_PTR instead of NULL
  2016-11-10 21:10 [PATCH] drm/rockchip: return ERR_PTR instead of NULL Julia Lawall
@ 2016-11-11  1:45 ` Mark yao
  2016-11-11  8:13   ` walter harms
  0 siblings, 1 reply; 4+ messages in thread
From: Mark yao @ 2016-11-11  1:45 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, linux-kernel, dri-devel, linux-rockchip,
	Christophe JAILLET, linux-arm-kernel

On 2016年11月11日 05:10, Julia Lawall wrote:
> rockchip_drm_framebuffer_init is only used in one case, in
> rockchip_drm_fbdev.c, where its return value is tested using IS_ERR.  To
> enable propagating the reason for the error, change the definition so that
> it returns an ERR_PTR value.
>
> Problem found with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Thanks for the fix.

Applied to my drm-next.

>
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_fb.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> index 0f6eda0..01e11bf 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> @@ -213,7 +213,7 @@ struct drm_framebuffer *
>   
>   	rockchip_fb = rockchip_fb_alloc(dev, mode_cmd, &obj, 1);
>   	if (IS_ERR(rockchip_fb))
> -		return NULL;
> +		return ERR_CAST(rockchip_fb);
>   
>   	return &rockchip_fb->fb;
>   }
>
>
>
>


-- 
Mark Yao



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

* Re: [PATCH] drm/rockchip: return ERR_PTR instead of NULL
  2016-11-11  1:45 ` Mark yao
@ 2016-11-11  8:13   ` walter harms
  2016-11-11  8:22     ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: walter harms @ 2016-11-11  8:13 UTC (permalink / raw)
  To: Mark yao; +Cc: Julia Lawall, kernel-janitors, linux-rockchip



Am 11.11.2016 02:45, schrieb Mark yao:
> On 2016年11月11日 05:10, Julia Lawall wrote:
>> rockchip_drm_framebuffer_init is only used in one case, in
>> rockchip_drm_fbdev.c, where its return value is tested using IS_ERR.  To
>> enable propagating the reason for the error, change the definition so
>> that
>> it returns an ERR_PTR value.
>>
>> Problem found with the help of Coccinelle.
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Thanks for the fix.
> 
> Applied to my drm-next.

Just for my curiosity.

can more go wrong that OOM ?

i did not see that.

re,
 wh


> 
>>
>> ---
>>   drivers/gpu/drm/rockchip/rockchip_drm_fb.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
>> b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
>> index 0f6eda0..01e11bf 100644
>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
>> @@ -213,7 +213,7 @@ struct drm_framebuffer *
>>         rockchip_fb = rockchip_fb_alloc(dev, mode_cmd, &obj, 1);
>>       if (IS_ERR(rockchip_fb))
>> -        return NULL;
>> +        return ERR_CAST(rockchip_fb);
>>         return &rockchip_fb->fb;
>>   }
>>
>>
>>
>>
> 
> 

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

* Re: [PATCH] drm/rockchip: return ERR_PTR instead of NULL
  2016-11-11  8:13   ` walter harms
@ 2016-11-11  8:22     ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2016-11-11  8:22 UTC (permalink / raw)
  To: walter harms; +Cc: Mark yao, kernel-janitors, linux-rockchip

[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]



On Fri, 11 Nov 2016, walter harms wrote:

>
>
> Am 11.11.2016 02:45, schrieb Mark yao:
> > On 2016年11月11日 05:10, Julia Lawall wrote:
> >> rockchip_drm_framebuffer_init is only used in one case, in
> >> rockchip_drm_fbdev.c, where its return value is tested using IS_ERR.  To
> >> enable propagating the reason for the error, change the definition so
> >> that
> >> it returns an ERR_PTR value.
> >>
> >> Problem found with the help of Coccinelle.
> >>
> >> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > Thanks for the fix.
> >
> > Applied to my drm-next.
>
> Just for my curiosity.
>
> can more go wrong that OOM ?

Unfolding rockchip_fb_alloc suggests that a variety of error codes can be
returned, notably from the function idr_alloc.

julia

>
> i did not see that.
>
> re,
>  wh
>
>
> >
> >>
> >> ---
> >>   drivers/gpu/drm/rockchip/rockchip_drm_fb.c |    2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> >> b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> >> index 0f6eda0..01e11bf 100644
> >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> >> @@ -213,7 +213,7 @@ struct drm_framebuffer *
> >>         rockchip_fb = rockchip_fb_alloc(dev, mode_cmd, &obj, 1);
> >>       if (IS_ERR(rockchip_fb))
> >> -        return NULL;
> >> +        return ERR_CAST(rockchip_fb);
> >>         return &rockchip_fb->fb;
> >>   }
> >>
> >>
> >>
> >>
> >
> >
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

end of thread, other threads:[~2016-11-11  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-10 21:10 [PATCH] drm/rockchip: return ERR_PTR instead of NULL Julia Lawall
2016-11-11  1:45 ` Mark yao
2016-11-11  8:13   ` walter harms
2016-11-11  8:22     ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox