]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: adc: max11410: make vref register name arrays static const
authorGiorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Mon, 23 Mar 2026 06:46:41 +0000 (10:46 +0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 25 Mar 2026 20:27:13 +0000 (20:27 +0000)
The vrefp_regs and vrefn_regs arrays are constant lookup tables and
are not modified.

Make them static const so they are not reinitialized on each probe
call and are placed in read-only memory. Mark the pointer array as
const as well to prevent unintended modification.

Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/max11410.c

index 511b2f14dfaf70721f269c5ca7bdf55107753b27..69351f4f10bbae79565fe30199a5405f947dd348 100644 (file)
@@ -912,8 +912,8 @@ static int max11410_self_calibrate(struct max11410_state *st)
 
 static int max11410_probe(struct spi_device *spi)
 {
-       const char *vrefp_regs[] = { "vref0p", "vref1p", "vref2p" };
-       const char *vrefn_regs[] = { "vref0n", "vref1n", "vref2n" };
+       static const char * const vrefp_regs[] = { "vref0p", "vref1p", "vref2p" };
+       static const char * const vrefn_regs[] = { "vref0n", "vref1n", "vref2n" };
        struct device *dev = &spi->dev;
        struct max11410_state *st;
        struct iio_dev *indio_dev;