lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 26 May 2020 11:31:56 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Dinghao Liu <dinghao.liu@....edu.cn>
Cc:     Kangjie Lu <kjlu@....edu>, Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-iio <linux-iio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Re: [PATCH] iio: magnetometer: ak8974: Fix runtime PM imbalance
 on error

On Tue, May 26, 2020 at 7:14 AM <dinghao.liu@....edu.cn> wrote:
> > On Sun, May 24, 2020 at 4:51 AM Dinghao Liu <dinghao.liu@....edu.cn> wrote:

> > >  disable_pm:
> > > -       pm_runtime_put_noidle(&i2c->dev);
> > >         pm_runtime_disable(&i2c->dev);
> > >         ak8974_set_power(ak8974, AK8974_PWR_OFF);
> >
> > Keep the top pm_runtime_put_noidle().
>
> I found that there was already a pm_runtime_put() before
> iio_triggered_buffer_setup() (just after pm_runtime_use_autosuspend).
> So if we keep the pm_runtime_put_noidle() here, we will have
> two pmusage counter decrement. Do you think this is a bug?

Yes you're right.

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(&i2c->dev,
                                         AK8974_AUTOSUSPEND_DELAY);
        pm_runtime_use_autosuspend(&i2c->dev);
        pm_runtime_put(&i2c->dev);

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ