diff options
author | Patrik Dahlström <risca@dalakolonin.se> | 2023-03-13 21:50:29 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-03-18 17:11:25 +0100 |
commit | 49f76c499d38bf67803438eee88c8300d0f6ce09 (patch) | |
tree | 16a70e9e50f94ebe0a0edbfce1303c74cda256d6 /drivers/iio/adc/palmas_gpadc.c | |
parent | iio: adc: max11410: fix read_poll_timeout() usage (diff) | |
download | linux-49f76c499d38bf67803438eee88c8300d0f6ce09.tar.xz linux-49f76c499d38bf67803438eee88c8300d0f6ce09.zip |
iio: adc: palmas_gpadc: fix NULL dereference on rmmod
Calling dev_to_iio_dev() on a platform device pointer is undefined and
will make adc NULL.
Signed-off-by: Patrik Dahlström <risca@dalakolonin.se>
Link: https://lore.kernel.org/r/20230313205029.1881745-1-risca@dalakolonin.se
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/palmas_gpadc.c')
-rw-r--r-- | drivers/iio/adc/palmas_gpadc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index fd000345ec5c..849a697a467e 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -639,7 +639,7 @@ out: static int palmas_gpadc_remove(struct platform_device *pdev) { - struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev); + struct iio_dev *indio_dev = dev_get_drvdata(&pdev->dev); struct palmas_gpadc *adc = iio_priv(indio_dev); if (adc->wakeup1_enable || adc->wakeup2_enable) |