On Thu, 20 Oct 2022 20:40:44 +0800 Zhang Qilong <zhangqilong3@xxxxxxxxxx> wrote: > 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. In addtion, > the iio_map_array path has potentially been called. > > We fix it by gotoing err_map when thermal_zone register > failed. > > Fixes: b0a242894f11 ("iio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm") > Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx> As mentioned in review of patch 2 there are other problems in here that will probably be better cleaned up by taking the whole lot over to devm Thanks, Jonathan > --- > v2: > - revert iio_map_array if it's necessary when thermal_zone > register failed. > --- > drivers/iio/adc/sun4i-gpadc-iio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c > index a6ade70dedf8..d2535dd28af8 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_map; > } > } >