Skip to content

Commit 784b470

Browse files
Olivier Moysanjic23
authored andcommitted
iio: adc: stm32: fix null pointer on defer_probe error
dev_err_probe() calls __device_set_deferred_probe_reason() on -EPROBE_DEFER error. If device pointer to driver core private structure is not initialized, an null pointer error occurs. This pointer is set on iio_device_register() call for iio device. dev_err_probe() must be called with the device which is probing. Replace iio device by its parent device. Fixes: 0e346b2 ("iio: adc: stm32-adc: add vrefint calibration support") Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Ahmad Fatoum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 652e7df commit 784b470

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/adc/stm32-adc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ static int stm32_adc_populate_int_ch(struct iio_dev *indio_dev, const char *ch_n
19871987
/* Get calibration data for vrefint channel */
19881988
ret = nvmem_cell_read_u16(&indio_dev->dev, "vrefint", &vrefint);
19891989
if (ret && ret != -ENOENT) {
1990-
return dev_err_probe(&indio_dev->dev, ret,
1990+
return dev_err_probe(indio_dev->dev.parent, ret,
19911991
"nvmem access error\n");
19921992
}
19931993
if (ret == -ENOENT)

0 commit comments

Comments
 (0)