Message ID | 20250422131040.374427-5-maddy@linux.ibm.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | Fixes for shellcheck/sparse warnings | expand |
Le 22/04/2025 à 15:10, Madhavan Srinivasan a écrit : > structs are local to the source and does not need to > be in global scope, so make it static. > > Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> > --- > arch/powerpc/kernel/btext.c | 2 +- > arch/powerpc/kernel/setup-common.c | 2 +- > arch/powerpc/platforms/powernv/opal.c | 2 +- > arch/powerpc/platforms/pseries/lparcfg.c | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c > index 7f63f1cdc6c3..fc7f5a5b6d76 100644 > --- a/arch/powerpc/kernel/btext.c > +++ b/arch/powerpc/kernel/btext.c > @@ -40,7 +40,7 @@ static int dispDeviceRect[4] __force_data; > static unsigned char *dispDeviceBase __force_data; > static unsigned char *logicalDisplayBase __force_data; > > -unsigned long disp_BAT[2] __initdata = {0, 0}; > +static unsigned long disp_BAT[2] __initdata = {0, 0}; disp_BAT is used in assembly, has to remain global: arch/powerpc/kernel/head_book3s_32.S: addis r8,r3,disp_BAT@ha arch/powerpc/kernel/head_book3s_32.S: addi r8,r8,disp_BAT@l Christophe
Hi Madhavan, kernel test robot noticed the following build warnings: [auto build test WARNING on powerpc/next] [also build test WARNING on powerpc/fixes powerpc/topic/ppc-kvm linus/master v6.15-rc5 next-20250507] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Madhavan-Srinivasan/powerpc-kvm-Fix-sparse-warning/20250422-211309 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next patch link: https://lore.kernel.org/r/20250422131040.374427-5-maddy%40linux.ibm.com patch subject: [PATCH 4/6] powerpc: fix sparse warnings config: powerpc64-randconfig-r053-20250424 (https://download.01.org/0day-ci/archive/20250507/202505071806.OPozZjqi-lkp@intel.com/config) compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250507/202505071806.OPozZjqi-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202505071806.OPozZjqi-lkp@intel.com/ All warnings (new ones prefixed by >>): >> arch/powerpc/kernel/btext.c:43:22: warning: unused variable 'disp_BAT' [-Wunused-variable] 43 | static unsigned long disp_BAT[2] __initdata = {0, 0}; | ^~~~~~~~ 1 warning generated. vim +/disp_BAT +43 arch/powerpc/kernel/btext.c 42 > 43 static unsigned long disp_BAT[2] __initdata = {0, 0}; 44
On 5/2/25 3:46 PM, Christophe Leroy wrote: > > > Le 22/04/2025 à 15:10, Madhavan Srinivasan a écrit : >> structs are local to the source and does not need to >> be in global scope, so make it static. >> >> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> >> --- >> arch/powerpc/kernel/btext.c | 2 +- >> arch/powerpc/kernel/setup-common.c | 2 +- >> arch/powerpc/platforms/powernv/opal.c | 2 +- >> arch/powerpc/platforms/pseries/lparcfg.c | 2 +- >> 4 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c >> index 7f63f1cdc6c3..fc7f5a5b6d76 100644 >> --- a/arch/powerpc/kernel/btext.c >> +++ b/arch/powerpc/kernel/btext.c >> @@ -40,7 +40,7 @@ static int dispDeviceRect[4] __force_data; >> static unsigned char *dispDeviceBase __force_data; >> static unsigned char *logicalDisplayBase __force_data; >> -unsigned long disp_BAT[2] __initdata = {0, 0}; >> +static unsigned long disp_BAT[2] __initdata = {0, 0}; > > disp_BAT is used in assembly, has to remain global: > > arch/powerpc/kernel/head_book3s_32.S: addis r8,r3,disp_BAT@ha > arch/powerpc/kernel/head_book3s_32.S: addi r8,r8,disp_BAT@l Thought I did a top folder level sweep for this. My bad. Nice catch. Will drop this. Thanks > > Christophe >
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 7f63f1cdc6c3..fc7f5a5b6d76 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -40,7 +40,7 @@ static int dispDeviceRect[4] __force_data; static unsigned char *dispDeviceBase __force_data; static unsigned char *logicalDisplayBase __force_data; -unsigned long disp_BAT[2] __initdata = {0, 0}; +static unsigned long disp_BAT[2] __initdata = {0, 0}; static int boot_text_mapped __force_data; diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 68d47c53876c..649e0cc31df7 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -350,7 +350,7 @@ static void c_stop(struct seq_file *m, void *v) { } -const struct seq_operations cpuinfo_op = { +static const struct seq_operations cpuinfo_op = { .start = c_start, .next = c_next, .stop = c_stop, diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 9ec265fcaff4..02af50a724bf 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -48,7 +48,7 @@ static LIST_HEAD(msg_list); /* /sys/firmware/opal */ struct kobject *opal_kobj; -struct opal { +static struct opal { u64 base; u64 entry; u64 size; diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c index cc22924f159f..830af843ef40 100644 --- a/arch/powerpc/platforms/pseries/lparcfg.c +++ b/arch/powerpc/platforms/pseries/lparcfg.c @@ -185,7 +185,7 @@ static long h_pic(unsigned long *pool_idle_time, return rc; } -unsigned long boot_pool_idle_time; +static unsigned long boot_pool_idle_time; /* * parse_ppp_data
structs are local to the source and does not need to be in global scope, so make it static. Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> --- arch/powerpc/kernel/btext.c | 2 +- arch/powerpc/kernel/setup-common.c | 2 +- arch/powerpc/platforms/powernv/opal.c | 2 +- arch/powerpc/platforms/pseries/lparcfg.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)