iio: adc: stm32-adc: set some stm32-adc.c variables storage-class-specifier to static
PATCH 1/1 iio: adc: stm32-adc: set some stm32-adc.c variables storage-class-specifier to static
smatch reports several warnings drivers/iio/adc/stm32-adc.c:2591:20: warning:
symbol 'stm32_adc_min_ts_h7' was not declared. Should it be static?drivers/iio/adc/stm32-adc.c:2610:20: warning:
symbol 'stm32_adc_min_ts_mp1' was not declared. Should it be static?drivers/iio/adc/stm32-adc.c:2630:20: warning:
symbol 'stm32_adc_min_ts_mp13' was not declared. Should it be static?
These variables are only used in stm32-adc.c, so they should be static
--- drivers/iio/adc/stm32-adc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/adc/stm32-adc.c +3 -3
@@ -2588,7 +2588,7 @@ static const struct stm32_adc_cfg stm32f4_adc_cfg = { .irq_clear = stm32f4_adc_irq_clear, }; -const unsigned int stm32_adc_min_ts_h7[] = {0 ,0 ,0 ,4300 ,9000 }; +static const unsigned int stm32_adc_min_ts_h7[] = {0 ,0 ,0 ,4300 ,9000 };static_assert (ARRAY_SIZE (stm32_adc_min_ts_h7) ==STM32_ADC_INT_CH_NB );static const struct stm32_adc_cfg stm32h7_adc_cfg = {
@@ -2607,7 +2607,7 @@ static const struct stm32_adc_cfg stm32h7_adc_cfg = { .ts_int_ch = stm32_adc_min_ts_h7, }; -const unsigned int stm32_adc_min_ts_mp1[] = {100 ,100 ,100 ,4300 ,9800 }; +static const unsigned int stm32_adc_min_ts_mp1[] = {100 ,100 ,100 ,4300 ,9800 };static_assert (ARRAY_SIZE (stm32_adc_min_ts_mp1) ==STM32_ADC_INT_CH_NB );static const struct stm32_adc_cfg stm32mp1_adc_cfg = {
@@ -2627,7 +2627,7 @@ static const struct stm32_adc_cfg stm32mp1_adc_cfg = { .ts_int_ch = stm32_adc_min_ts_mp1, }; -const unsigned int stm32_adc_min_ts_mp13[] = {100 ,0 ,0 ,4300 ,9800 }; +static const unsigned int stm32_adc_min_ts_mp13[] = {100 ,0 ,0 ,4300 ,9800 };static_assert (ARRAY_SIZE (stm32_adc_min_ts_mp13) ==STM32_ADC_INT_CH_NB );static const struct stm32_adc_cfg stm32mp13_adc_cfg = {
Signature · 7 lines
2.27.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Jonathan Cameron
maintainerQuoted 11 lines · On Sun, 12 Mar 2023 12:17:33 -0400 Tom Rix <[email protected]> wrote:
smatch reports several warnings
drivers/iio/adc/stm32-adc.c:2591:20: warning:
symbol 'stm32_adc_min_ts_h7' was not declared. Should it be static?drivers/iio/adc/stm32-adc.c:2610:20: warning:
symbol 'stm32_adc_min_ts_mp1' was not declared. Should it be static?drivers/iio/adc/stm32-adc.c:2630:20: warning:
symbol 'stm32_adc_min_ts_mp13' was not declared. Should it be static?These variables are only used in
stm32-adc.c, so they should be staticSigned-off-by Tom Rix <[email protected]>
Thanks Tom,
I wonder why these didn't show up in earlier build reports? Ah well.
Applied to the togreg branch of iio.git and pushed out as testing for 0-day to take a look at it.
Thanks,
Jonathan
Quoted 35 lines
--- drivers/iio/adc/stm32-adc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/iio/adc/stm32-adc.c +3
-3@@ -2588,7 +2588,7 @@ static const struct stm32_adc_cfg stm32f4_adc_cfg = { .irq_clear = stm32f4_adc_irq_clear, }; -const unsigned int stm32_adc_min_ts_h7[] = {0 ,0 ,0 ,4300 ,9000 }; +static const unsigned int stm32_adc_min_ts_h7[] = {0 ,0 ,0 ,4300 ,9000 };static_assert (ARRAY_SIZE (stm32_adc_min_ts_h7) ==STM32_ADC_INT_CH_NB );static const struct stm32_adc_cfg stm32h7_adc_cfg = {@@ -2607,7 +2607,7 @@ static const struct stm32_adc_cfg stm32h7_adc_cfg = { .ts_int_ch = stm32_adc_min_ts_h7, }; -const unsigned int stm32_adc_min_ts_mp1[] = {100 ,100 ,100 ,4300 ,9800 }; +static const unsigned int stm32_adc_min_ts_mp1[] = {100 ,100 ,100 ,4300 ,9800 };static_assert (ARRAY_SIZE (stm32_adc_min_ts_mp1) ==STM32_ADC_INT_CH_NB );static const struct stm32_adc_cfg stm32mp1_adc_cfg = {@@ -2627,7 +2627,7 @@ static const struct stm32_adc_cfg stm32mp1_adc_cfg = { .ts_int_ch = stm32_adc_min_ts_mp1, }; -const unsigned int stm32_adc_min_ts_mp13[] = {100 ,0 ,0 ,4300 ,9800 }; +static const unsigned int stm32_adc_min_ts_mp13[] = {100 ,0 ,0 ,4300 ,9800 };static_assert (ARRAY_SIZE (stm32_adc_min_ts_mp13) ==STM32_ADC_INT_CH_NB );static const struct stm32_adc_cfg stm32mp13_adc_cfg = {