All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] clk/keystone: fix application of sizeof to pointer
@ 2021-08-20  2:20 ` jing yangyang
  0 siblings, 0 replies; 4+ messages in thread
From: jing yangyang @ 2021-08-20  2:20 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Tero Kristo, Santosh Shilimkar, Michael Turquette, Stephen Boyd,
	linux-arm-kernel, linux-kernel, linux-clk, jing yangyang,
	Zeal Robot

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

./drivers/clk/keystone/sci-clk.c:398:8-14: ERROR application of sizeof to pointer

This issue was detected with the help of Coccinelle.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
---
 drivers/clk/keystone/sci-clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 7e1b136..010a61a 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -395,7 +395,7 @@ static struct clk_hw *sci_clk_get(struct of_phandle_args *clkspec, void *data)
 	key.clk_id = clkspec->args[1];
 
 	clk = bsearch(&key, provider->clocks, provider->num_clocks,
-		      sizeof(clk), _cmp_sci_clk);
+		      sizeof(*clk), _cmp_sci_clk);
 
 	if (!clk)
 		return ERR_PTR(-ENODEV);
-- 
1.8.3.1



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

* [PATCH linux-next] clk/keystone: fix application of sizeof to pointer
@ 2021-08-20  2:20 ` jing yangyang
  0 siblings, 0 replies; 4+ messages in thread
From: jing yangyang @ 2021-08-20  2:20 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Tero Kristo, Santosh Shilimkar, Michael Turquette, Stephen Boyd,
	linux-arm-kernel, linux-kernel, linux-clk, jing yangyang,
	Zeal Robot

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

./drivers/clk/keystone/sci-clk.c:398:8-14: ERROR application of sizeof to pointer

This issue was detected with the help of Coccinelle.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
---
 drivers/clk/keystone/sci-clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 7e1b136..010a61a 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -395,7 +395,7 @@ static struct clk_hw *sci_clk_get(struct of_phandle_args *clkspec, void *data)
 	key.clk_id = clkspec->args[1];
 
 	clk = bsearch(&key, provider->clocks, provider->num_clocks,
-		      sizeof(clk), _cmp_sci_clk);
+		      sizeof(*clk), _cmp_sci_clk);
 
 	if (!clk)
 		return ERR_PTR(-ENODEV);
-- 
1.8.3.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 linux-next] clk/keystone: fix application of sizeof to pointer
  2021-08-20  2:20 ` jing yangyang
@ 2021-08-20 17:49   ` Nishanth Menon
  -1 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2021-08-20 17:49 UTC (permalink / raw)
  To: jing yangyang
  Cc: Tero Kristo, Santosh Shilimkar, Michael Turquette, Stephen Boyd,
	linux-arm-kernel, linux-kernel, linux-clk, jing yangyang,
	Zeal Robot

On 19:20-20210819, jing yangyang wrote:
> sizeof when applied to a pointer typed expression gives the size of
> the pointer.
> 
> ./drivers/clk/keystone/sci-clk.c:398:8-14: ERROR application of sizeof to pointer
> 
> This issue was detected with the help of Coccinelle.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
> ---
>  drivers/clk/keystone/sci-clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
> index 7e1b136..010a61a 100644
> --- a/drivers/clk/keystone/sci-clk.c
> +++ b/drivers/clk/keystone/sci-clk.c
> @@ -395,7 +395,7 @@ static struct clk_hw *sci_clk_get(struct of_phandle_args *clkspec, void *data)
>  	key.clk_id = clkspec->args[1];
>  
>  	clk = bsearch(&key, provider->clocks, provider->num_clocks,
> -		      sizeof(clk), _cmp_sci_clk);
> +		      sizeof(*clk), _cmp_sci_clk);

I am trying to understand this.. bsearch uses base + size to do
iteration, provider is sci_clk_provider ->num_clocks is struct sci_clk
** same as clk. iteration is done on provider->clocks .. not on *clk,
am I missing something? or is it one of those testing patches?

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

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

* Re: [PATCH linux-next] clk/keystone: fix application of sizeof to pointer
@ 2021-08-20 17:49   ` Nishanth Menon
  0 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2021-08-20 17:49 UTC (permalink / raw)
  To: jing yangyang
  Cc: Tero Kristo, Santosh Shilimkar, Michael Turquette, Stephen Boyd,
	linux-arm-kernel, linux-kernel, linux-clk, jing yangyang,
	Zeal Robot

On 19:20-20210819, jing yangyang wrote:
> sizeof when applied to a pointer typed expression gives the size of
> the pointer.
> 
> ./drivers/clk/keystone/sci-clk.c:398:8-14: ERROR application of sizeof to pointer
> 
> This issue was detected with the help of Coccinelle.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
> ---
>  drivers/clk/keystone/sci-clk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
> index 7e1b136..010a61a 100644
> --- a/drivers/clk/keystone/sci-clk.c
> +++ b/drivers/clk/keystone/sci-clk.c
> @@ -395,7 +395,7 @@ static struct clk_hw *sci_clk_get(struct of_phandle_args *clkspec, void *data)
>  	key.clk_id = clkspec->args[1];
>  
>  	clk = bsearch(&key, provider->clocks, provider->num_clocks,
> -		      sizeof(clk), _cmp_sci_clk);
> +		      sizeof(*clk), _cmp_sci_clk);

I am trying to understand this.. bsearch uses base + size to do
iteration, provider is sci_clk_provider ->num_clocks is struct sci_clk
** same as clk. iteration is done on provider->clocks .. not on *clk,
am I missing something? or is it one of those testing patches?

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

_______________________________________________
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:[~2021-08-20 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20  2:20 [PATCH linux-next] clk/keystone: fix application of sizeof to pointer jing yangyang
2021-08-20  2:20 ` jing yangyang
2021-08-20 17:49 ` Nishanth Menon
2021-08-20 17:49   ` Nishanth Menon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.