Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1682740 > unrolled thread

[PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value

Started by"Gustavo A. R. Silva" <garsilva@embeddedor.com>
First post2017-07-07 00:00 +0200
Last post2017-07-11 02:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-07-07 00:00 +0200
    Re: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return  value Mark yao <mark.yao@rock-chips.com> - 2017-07-07 03:00 +0200
      Re: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return  value Sean Paul <seanpaul@chromium.org> - 2017-07-10 21:10 +0200
        Re: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return  value Mark yao <mark.yao@rock-chips.com> - 2017-07-11 02:50 +0200

#1682740 — [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value

From"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date2017-07-07 00:00 +0200
Subject[PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value
Message-ID<u0mYy-2Sz-31@gated-at.bofh.it>
The right variable to check here is port, not dp.

This issue was detected using Coccinelle and the following semantic patch:

@@
expression x;
identifier fld;
@@

* x = devm_kzalloc(...);
  ... when != x == NULL
  x->fld

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index 14fa1f8..9b0b058 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -1195,7 +1195,7 @@ static int cdn_dp_probe(struct platform_device *pdev)
 			continue;
 
 		port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
-		if (!dp)
+		if (!port)
 			return -ENOMEM;
 
 		port->extcon = extcon;
-- 
2.5.0

[toc] | [next] | [standalone]


#1682839 — Re: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value

FromMark yao <mark.yao@rock-chips.com>
Date2017-07-07 03:00 +0200
SubjectRe: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value
Message-ID<u0pMJ-4D0-3@gated-at.bofh.it>
In reply to#1682740
On 2017年07月07日 05:58, Gustavo A. R. Silva wrote:
> The right variable to check here is port, not dp.
>
> This issue was detected using Coccinelle and the following semantic patch:
>
> @@
> expression x;
> identifier fld;
> @@
>
> * x = devm_kzalloc(...);
>    ... when != x == NULL
>    x->fld
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Thanks for the fix,

Acked-by: Mark Yao <mark.yao@rock-chips.com>

> ---
>   drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> index 14fa1f8..9b0b058 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> @@ -1195,7 +1195,7 @@ static int cdn_dp_probe(struct platform_device *pdev)
>   			continue;
>   
>   		port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
> -		if (!dp)
> +		if (!port)
>   			return -ENOMEM;
>   
>   		port->extcon = extcon;


-- 
Mark Yao

[toc] | [prev] | [next] | [standalone]


#1684592 — Re: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value

FromSean Paul <seanpaul@chromium.org>
Date2017-07-10 21:10 +0200
SubjectRe: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value
Message-ID<u1Mee-y8-19@gated-at.bofh.it>
In reply to#1682839
On Fri, Jul 07, 2017 at 08:56:28AM +0800, Mark yao wrote:
> On 2017年07月07日 05:58, Gustavo A. R. Silva wrote:
> > The right variable to check here is port, not dp.
> > 
> > This issue was detected using Coccinelle and the following semantic patch:
> > 
> > @@
> > expression x;
> > identifier fld;
> > @@
> > 
> > * x = devm_kzalloc(...);
> >    ... when != x == NULL
> >    x->fld
> > 
> > Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> 
> Thanks for the fix,
> 
> Acked-by: Mark Yao <mark.yao@rock-chips.com>

Hi Mark,
I've applied this patch, but in the future, please apply changes directly
instead of just acking. 

If you're unable to apply it for some reason (vacation, etc), please reach out to
one of the -misc maintainers via email or irc so we don't inadvertently lose track
of it on the list.

Sean

> 
> > ---
> >   drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> > index 14fa1f8..9b0b058 100644
> > --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
> > +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> > @@ -1195,7 +1195,7 @@ static int cdn_dp_probe(struct platform_device *pdev)
> >   			continue;
> >   		port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
> > -		if (!dp)
> > +		if (!port)
> >   			return -ENOMEM;
> >   		port->extcon = extcon;
> 
> 
> -- 
> Mark Yao
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS

[toc] | [prev] | [next] | [standalone]


#1684708 — Re: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value

FromMark yao <mark.yao@rock-chips.com>
Date2017-07-11 02:50 +0200
SubjectRe: [PATCH] drm/rockchip: fix NULL check on devm_kzalloc() return value
Message-ID<u1Rxg-3FO-7@gated-at.bofh.it>
In reply to#1684592
On 2017年07月11日 03:04, Sean Paul wrote:
> On Fri, Jul 07, 2017 at 08:56:28AM +0800, Mark yao wrote:
>> On 2017年07月07日 05:58, Gustavo A. R. Silva wrote:
>>> The right variable to check here is port, not dp.
>>>
>>> This issue was detected using Coccinelle and the following semantic patch:
>>>
>>> @@
>>> expression x;
>>> identifier fld;
>>> @@
>>>
>>> * x = devm_kzalloc(...);
>>>     ... when != x == NULL
>>>     x->fld
>>>
>>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> Thanks for the fix,
>>
>> Acked-by: Mark Yao <mark.yao@rock-chips.com>
> Hi Mark,
> I've applied this patch, but in the future, please apply changes directly
> instead of just acking.
>
> If you're unable to apply it for some reason (vacation, etc), please reach out to
> one of the -misc maintainers via email or irc so we don't inadvertently lose track
> of it on the list.
>
> Sean
Hi Sean

Got it,  I  will do it right next time.
Thanks to inform me this,

>
>>> ---
>>>    drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>>> index 14fa1f8..9b0b058 100644
>>> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
>>> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>>> @@ -1195,7 +1195,7 @@ static int cdn_dp_probe(struct platform_device *pdev)
>>>    			continue;
>>>    		port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
>>> -		if (!dp)
>>> +		if (!port)
>>>    			return -ENOMEM;
>>>    		port->extcon = extcon;
>>
>> -- 
>> Mark Yao
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel


-- 
Mark Yao

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web