diff mbox

stmmac: fix noderef.cocci warnings

Message ID 20160303015519.GA43500@lkp-nex06
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

kbuild test robot March 3, 2016, 1:55 a.m. UTC
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:115:15-21: ERROR: application of sizeof to pointer

 sizeof when applied to a pointer typed expression gives the size of
 the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 stmmac_platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre TORGUE March 4, 2016, 12:45 p.m. UTC | #1
Hi,

On 03/03/2016 02:55 AM, kbuild test robot wrote:
> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:115:15-21: ERROR: application of sizeof to pointer
>
>   sizeof when applied to a pointer typed expression gives the size of
>   the pointer
>
> Generated by: scripts/coccinelle/misc/noderef.cocci
>
> CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
>
>   stmmac_platform.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -112,7 +112,7 @@ static struct stmmac_axi *stmmac_axi_set
>   	if (!np)
>   		return NULL;
>
> -	axi = kzalloc(sizeof(axi), GFP_KERNEL);
> +	axi = kzalloc(sizeof(*axi), GFP_KERNEL);
>   	if (!axi)
>   		return ERR_PTR(-ENOMEM);
>
>


Thanks.
You can add my Acked-by: Alexandre Torgue <alexandre.torgue@st.com>
David Miller March 4, 2016, 9:32 p.m. UTC | #2
From: Alexandre Torgue <alexandre.torgue@st.com>
Date: Fri, 4 Mar 2016 13:45:40 +0100

> Hi,
> 
> On 03/03/2016 02:55 AM, kbuild test robot wrote:
>> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:115:15-21:
>> ERROR: application of sizeof to pointer
>>
>>   sizeof when applied to a pointer typed expression gives the size of
>>   the pointer
>>
>> Generated by: scripts/coccinelle/misc/noderef.cocci
>>
>> CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
>> ---
>>
>>   stmmac_platform.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> @@ -112,7 +112,7 @@ static struct stmmac_axi *stmmac_axi_set
>>   	if (!np)
>>   		return NULL;
>>
>> -	axi = kzalloc(sizeof(axi), GFP_KERNEL);
>> +	axi = kzalloc(sizeof(*axi), GFP_KERNEL);
>>   	if (!axi)
>>   		return ERR_PTR(-ENOMEM);
>>
>>
> 
> 
> Thanks.
> You can add my Acked-by: Alexandre Torgue <alexandre.torgue@st.com>

Don't do this.

Automated tools look for Acked-by: tags in replies to patch postings
in a certain way, so you must provide you Acked-by: on the first
column of a line in order for it to be picked up properly by those
tools.
David Miller March 7, 2016, 3:46 a.m. UTC | #3
From: kbuild test robot <fengguang.wu@intel.com>
Date: Thu, 3 Mar 2016 09:55:19 +0800

> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:115:15-21: ERROR: application of sizeof to pointer
> 
>  sizeof when applied to a pointer typed expression gives the size of
>  the pointer
> 
> Generated by: scripts/coccinelle/misc/noderef.cocci
> 
> CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Applied, thanks.
diff mbox

Patch

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -112,7 +112,7 @@  static struct stmmac_axi *stmmac_axi_set
 	if (!np)
 		return NULL;
 
-	axi = kzalloc(sizeof(axi), GFP_KERNEL);
+	axi = kzalloc(sizeof(*axi), GFP_KERNEL);
 	if (!axi)
 		return ERR_PTR(-ENOMEM);