diff options
author | Alexandru Ardelean <aardelean@deviqon.com> | 2021-08-23 13:22:00 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-09-14 13:00:31 +0200 |
commit | 9f0b3e0cc0c88618aa9e5cecef747b1337ae0a5d (patch) | |
tree | 3c8288f26f7c5ac4201889f8801fa8ed8612ab4c /drivers/iio/magnetometer/st_magn_spi.c | |
parent | iio: adc: ad7949: use devm managed functions (diff) | |
download | linux-9f0b3e0cc0c88618aa9e5cecef747b1337ae0a5d.tar.xz linux-9f0b3e0cc0c88618aa9e5cecef747b1337ae0a5d.zip |
iio: st_sensors: disable regulators after device unregistration
Up until commit ea7e586bdd331 ("iio: st_sensors: move regulator retrieveal
to core") only the ST pressure driver seems to have had any regulator
disable. After that commit, the regulator handling was moved into the
common st_sensors logic.
In all instances of this regulator handling, the regulators were disabled
before unregistering the IIO device.
This can cause issues where the device would be powered down and still be
available to userspace, allowing it to send invalid/garbage data.
This change moves the st_sensors_power_disable() after the common probe
functions. These common probe functions also handle unregistering the IIO
device.
Fixes: 774487611c949 ("iio: pressure-core: st: Provide support for the Vdd power supply")
Fixes: ea7e586bdd331 ("iio: st_sensors: move regulator retrieveal to core")
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210823112204.243255-2-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/magnetometer/st_magn_spi.c')
-rw-r--r-- | drivers/iio/magnetometer/st_magn_spi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c index fba978796395..ff43cbf61b05 100644 --- a/drivers/iio/magnetometer/st_magn_spi.c +++ b/drivers/iio/magnetometer/st_magn_spi.c @@ -96,10 +96,10 @@ static int st_magn_spi_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); - st_sensors_power_disable(indio_dev); - st_magn_common_remove(indio_dev); + st_sensors_power_disable(indio_dev); + return 0; } |