The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. Fixes:b0a242894f11d ("iio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm") Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx> --- drivers/iio/adc/sun4i-gpadc-iio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index a6ade70dedf8..ec0b09878d54 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -648,7 +648,8 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "could not register thermal sensor: %ld\n", PTR_ERR(info->tzd)); - return PTR_ERR(info->tzd); + ret = PTR_ERR(info->tzd); + goto err_pm; } } @@ -663,7 +664,7 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) err_map: if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF)) iio_map_array_unregister(indio_dev); - +err_pm: pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); -- 2.25.1