Skip to content

Commit 49f76c4

Browse files
Riscajic23
authored andcommitted
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>
1 parent 7b3825e commit 49f76c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/adc/palmas_gpadc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev)
639639

640640
static int palmas_gpadc_remove(struct platform_device *pdev)
641641
{
642-
struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev);
642+
struct iio_dev *indio_dev = dev_get_drvdata(&pdev->dev);
643643
struct palmas_gpadc *adc = iio_priv(indio_dev);
644644

645645
if (adc->wakeup1_enable || adc->wakeup2_enable)

0 commit comments

Comments
 (0)