linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] staging: mt7621-pinctrl: Use correct pointer type argument for sizeof
  2020-04-20 12:37 [PATCH] staging: mt7621-pinctrl: Use correct pointer type argument for sizeof Jason Yan
@ 2020-04-20 12:19 ` Dan Carpenter
  2020-04-20 12:34   ` Jason Yan
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2020-04-20 12:19 UTC (permalink / raw)
  To: Jason Yan
  Cc: devel, gregkh, linux-kernel, linux-mediatek, nishkadg.linux,
	matthias.bgg, linux-arm-kernel

On Mon, Apr 20, 2020 at 08:37:55PM +0800, Jason Yan wrote:
> Fix the following coccicheck warning:
> 
> drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c:223:14-36: WARNING: Use
> correct pointer type argument for sizeof
> 
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> ---
>  drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> index d0f06790d38f..8883f2a8ea57 100644
> --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> @@ -220,7 +220,7 @@ static int rt2880_pinmux_index(struct rt2880_priv *p)
>  	/* allocate our function and group mapping index buffers */
>  	f = p->func = devm_kcalloc(p->dev,
>  				   p->func_count,
> -				   sizeof(struct rt2880_pmx_func),
> +				   sizeof(struct rt2880_pmx_func *),

Yes.  This fixes a bug.  We were allocating too much data.  But the
prefered style is:

				sizeof(*p->func),

Please could you resend?

regards,
dan carpenter


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] staging: mt7621-pinctrl: Use correct pointer type argument for sizeof
  2020-04-20 12:19 ` Dan Carpenter
@ 2020-04-20 12:34   ` Jason Yan
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Yan @ 2020-04-20 12:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, gregkh, linux-kernel, linux-mediatek, nishkadg.linux,
	matthias.bgg, linux-arm-kernel



在 2020/4/20 20:19, Dan Carpenter 写道:
> On Mon, Apr 20, 2020 at 08:37:55PM +0800, Jason Yan wrote:
>> Fix the following coccicheck warning:
>>
>> drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c:223:14-36: WARNING: Use
>> correct pointer type argument for sizeof
>>
>> Signed-off-by: Jason Yan <yanaijie@huawei.com>
>> ---
>>   drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
>> index d0f06790d38f..8883f2a8ea57 100644
>> --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
>> +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
>> @@ -220,7 +220,7 @@ static int rt2880_pinmux_index(struct rt2880_priv *p)
>>   	/* allocate our function and group mapping index buffers */
>>   	f = p->func = devm_kcalloc(p->dev,
>>   				   p->func_count,
>> -				   sizeof(struct rt2880_pmx_func),
>> +				   sizeof(struct rt2880_pmx_func *),
> 
> Yes.  This fixes a bug.  We were allocating too much data.  But the
> prefered style is:
> 
> 				sizeof(*p->func),
> 
> Please could you resend?
> 

Sure, I will cook a new one.

> regards,
> dan carpenter
> 
> 
> .
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] staging: mt7621-pinctrl: Use correct pointer type argument for sizeof
@ 2020-04-20 12:37 Jason Yan
  2020-04-20 12:19 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Yan @ 2020-04-20 12:37 UTC (permalink / raw)
  To: gregkh, matthias.bgg, nishkadg.linux, devel, linux-arm-kernel,
	linux-mediatek, linux-kernel
  Cc: Jason Yan

Fix the following coccicheck warning:

drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c:223:14-36: WARNING: Use
correct pointer type argument for sizeof

Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index d0f06790d38f..8883f2a8ea57 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -220,7 +220,7 @@ static int rt2880_pinmux_index(struct rt2880_priv *p)
 	/* allocate our function and group mapping index buffers */
 	f = p->func = devm_kcalloc(p->dev,
 				   p->func_count,
-				   sizeof(struct rt2880_pmx_func),
+				   sizeof(struct rt2880_pmx_func *),
 				   GFP_KERNEL);
 	gpio_func.groups = devm_kcalloc(p->dev, p->group_count, sizeof(int),
 					GFP_KERNEL);
-- 
2.21.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] staging: mt7621-pinctrl: Use correct pointer type argument for sizeof
       [not found] <20200408071112.11578-1-vkor@vkten.in>
@ 2020-04-08  7:33 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-08  7:33 UTC (permalink / raw)
  To: R Veera Kumar
  Cc: Matthias Brugger, devel, linux-mediatek, linux-kernel, linux-arm-kernel

On Wed, Apr 08, 2020 at 12:41:12PM +0530, R Veera Kumar wrote:
> Use correct pointer type argument for sizeof.
> Found using coccinelle.
> 
> Signed-off-by: R Veera Kumar <vkor@vkten.in>
> ---
>  drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> index d0f06790d38f..62babad5ee0b 100644
> --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> @@ -220,7 +220,7 @@ static int rt2880_pinmux_index(struct rt2880_priv *p)
>  	/* allocate our function and group mapping index buffers */
>  	f = p->func = devm_kcalloc(p->dev,
>  				   p->func_count,
> -				   sizeof(struct rt2880_pmx_func),
> +				   sizeof(rt2880_pmx_func),

Did you build this change?

Always do so.

Also, nothing is really wrong with the existing code, remember,
checkpatch is a hint, telling you that maybe something is odd with this
line.  It is not always correct.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-04-20 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 12:37 [PATCH] staging: mt7621-pinctrl: Use correct pointer type argument for sizeof Jason Yan
2020-04-20 12:19 ` Dan Carpenter
2020-04-20 12:34   ` Jason Yan
     [not found] <20200408071112.11578-1-vkor@vkten.in>
2020-04-08  7:33 ` Greg Kroah-Hartman

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).