Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: max11410: make vref register name arrays static const

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>

authored by

Giorgi Tchankvetadze and committed by
Jonathan Cameron
6b4cd7b7 7198b881

+2 -2
+2 -2
drivers/iio/adc/max11410.c
··· 912 912 913 913 static int max11410_probe(struct spi_device *spi) 914 914 { 915 - const char *vrefp_regs[] = { "vref0p", "vref1p", "vref2p" }; 916 - const char *vrefn_regs[] = { "vref0n", "vref1n", "vref2n" }; 915 + static const char * const vrefp_regs[] = { "vref0p", "vref1p", "vref2p" }; 916 + static const char * const vrefn_regs[] = { "vref0n", "vref1n", "vref2n" }; 917 917 struct device *dev = &spi->dev; 918 918 struct max11410_state *st; 919 919 struct iio_dev *indio_dev;