Re: Re: Re: [PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance on error

2020-05-26 Thread dinghao . liu
> What about just moving the pm_runtime_put() until the end > of the initialization? Right before return 0; > Then we can keep this nice goto exits as they are. > > Maybe move all these three: > > pm_runtime_set_autosuspend_delay(>dev, >

Re: Re: [PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance on error

2020-05-26 Thread Linus Walleij
On Tue, May 26, 2020 at 7:14 AM wrote: > > On Sun, May 24, 2020 at 4:51 AM Dinghao Liu wrote: > > > disable_pm: > > > - pm_runtime_put_noidle(>dev); > > > pm_runtime_disable(>dev); > > > ak8974_set_power(ak8974, AK8974_PWR_OFF); > > > > Keep the top

Re: Re: [PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance on error

2020-05-25 Thread dinghao . liu
Hi, Linus > On Sun, May 24, 2020 at 4:51 AM Dinghao Liu wrote: > > > When devm_regmap_init_i2c() returns an error code, a pairing > > runtime PM usage counter decrement is needed to keep the > > counter balanced. For error paths after ak8974_set_power(), > > ak8974_detect() and ak8974_reset(),

Re: [PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance on error

2020-05-25 Thread Linus Walleij
On Sun, May 24, 2020 at 4:51 AM Dinghao Liu wrote: > When devm_regmap_init_i2c() returns an error code, a pairing > runtime PM usage counter decrement is needed to keep the > counter balanced. For error paths after ak8974_set_power(), > ak8974_detect() and ak8974_reset(), things are the same. >

[PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance on error

2020-05-23 Thread Dinghao Liu
When devm_regmap_init_i2c() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. For error paths after ak8974_set_power(), ak8974_detect() and ak8974_reset(), things are the same. However, When iio_triggered_buffer_setup() returns an error