[PATCH] clk: keystone: sci-clk: fix application of sizeof to pointer
Nishanth Menon
nm at ti.com
Fri May 8 08:23:21 PDT 2026
From: Jing Yangyang <jing.yangyang at zte.com.cn>
Coccinelle (scripts/coccinelle/misc/noderef.cocci) reports:
drivers/clk/keystone/sci-clk.c:391:8-14: ERROR: application of
sizeof to pointer
provider->clocks is an array of struct sci_clk *, so bsearch()
expects the size of each element (struct sci_clk *). However,
sizeof(clk) evaluates to the size of a pointer-to-pointer.
Use sizeof(*clk) to pass the correct element size.
Reported-by: Zeal Robot <zealci at zte.com.cn>
Closes: https://lore.kernel.org/all/84a6ba16686347099a3dab2e5161a930e792eb6e.1629198281.git.jing.yangyang@zte.com.cn/
Reported-by: kernel test robot <lkp at intel.com>
Reported-by: Julia Lawall <julia.lawall at inria.fr>
Closes: https://lore.kernel.org/all/202512040525.zrHSDl5h-lkp@intel.com/
Link: https://lore.kernel.org/linux-clk/20211012021931.176727-1-davidcomponentone@gmail.com/
Signed-off-by: Jing Yangyang <jing.yangyang at zte.com.cn>
Signed-off-by: David Yang <davidcomponentone at gmail.com>
[nm at ti.com: Improved commit message]
Signed-off-by: Nishanth Menon <nm at ti.com>
---
Cc: Jing Yangyang <cgel.zte at gmail.com>
Cc: Ran Sun <sunran001 at 208suo.com>
- Functionality: No impact (on Linux architectures), thus no Fixes/Stable tag.
- History: This patch has long-standing history; I have attributed it to the
earliest valid author found during a recent scrub.
- Reports: Retained chronological attribution even where public reports (Zeal
Robot) are unavailable.
- Checkpatch: Acknowledging minor warning regarding tag ordering (Reported-by
/ Closes sequence); chosen to maintain link integrity for automated tools.
- Testing: Verified on available K3 SoCs against 2026-05-07:
https://gist.github.com/nmenon/afa9ac915e189334f048c177f16fe54f
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 9d5071223f4c..2fc1f050779b 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -388,7 +388,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);
--
2.47.0
More information about the linux-arm-kernel
mailing list