mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 01:45:18 +02:00
staging: iio: resolver: ad2s1210: fix use before initialization
[ Upstream commit 7fe2d05cee
]
This fixes a use before initialization in ad2s1210_probe(). The
ad2s1210_setup_gpios() function uses st->sdev but it was being called
before this field was initialized.
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20230929-ad2s1210-mainline-v3-2-fa4364281745@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
84d6173880
commit
b87691d733
|
@ -658,9 +658,6 @@ static int ad2s1210_probe(struct spi_device *spi)
|
|||
if (!indio_dev)
|
||||
return -ENOMEM;
|
||||
st = iio_priv(indio_dev);
|
||||
ret = ad2s1210_setup_gpios(st);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
spi_set_drvdata(spi, indio_dev);
|
||||
|
||||
|
@ -671,6 +668,10 @@ static int ad2s1210_probe(struct spi_device *spi)
|
|||
st->resolution = 12;
|
||||
st->fexcit = AD2S1210_DEF_EXCIT;
|
||||
|
||||
ret = ad2s1210_setup_gpios(st);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
indio_dev->info = &ad2s1210_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = ad2s1210_channels;
|
||||
|
|
Loading…
Reference in New Issue
Block a user