drivers/gpu/drm/logicvc/logicvc_drm.c:233:26: warning: Local variable 'clocks' shadows outer variable [shadowVariable]
From: kernel test robot
Date: Wed Jan 04 2023 - 09:29:04 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 69b41ac87e4a664de78a395ff97166f0b2943210
commit: efeeaefe9be56e8ae5e5b4e9ff6d2275ec977ec5 drm: Add support for the LogiCVC display controller
date: 7 months ago
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout efeeaefe9be56e8ae5e5b4e9ff6d2275ec977ec5
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/logicvc/logicvc_drm.c:233:26: warning: Local variable 'clocks' shadows outer variable [shadowVariable]
clk_disable_unprepare(*clocks[i]);
^
drivers/gpu/drm/logicvc/logicvc_drm.c:221:15: note: Shadowed declaration
struct clk **clocks[] = {
^
drivers/gpu/drm/logicvc/logicvc_drm.c:233:26: note: Shadow variable
clk_disable_unprepare(*clocks[i]);
^
vim +/clocks +233 drivers/gpu/drm/logicvc/logicvc_drm.c
218
219 static int logicvc_clocks_unprepare(struct logicvc_drm *logicvc)
220 {
221 struct clk **clocks[] = {
222 &logicvc->vclk,
223 &logicvc->vclk2,
224 &logicvc->lvdsclk,
225 &logicvc->lvdsclkn,
226 };
227 unsigned int i;
228
229 for (i = 0; i < ARRAY_SIZE(clocks); i++) {
230 if (!*clocks[i])
231 continue;
232
> 233 clk_disable_unprepare(*clocks[i]);
234 *clocks[i] = NULL;
235 }
236
237 return 0;
238 }
239
--
0-DAY CI Kernel Test Service
https://01.org/lkp