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:   Sun, 19 Jun 2022 13:44:43 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Shreeya Patel <shreeya.patel@...labora.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>, Zhigang.Shi@...eon.com,
        krisman@...labora.com, linux-iio <linux-iio@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Collabora Kernel ML <kernel@...labora.com>,
        alvaro.soliverez@...labora.com, Dmitry Osipenko <digetx@...il.com>,
        kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v6 2/2] iio: light: Add support for ltrf216a sensor



> 
> > +       /* reset sensor, chip fails to respond to this, so ignore any errors */
> > +       ltrf216a_reset(indio_dev);
> > +
> > +       ret = pm_runtime_set_active(&client->dev);
> > +       if (ret)
> > +               goto error_power_down;  
> 
> Why do you need to power down here?
> 
> > +       pm_runtime_enable(&client->dev);

We now have devm_pm_runtime_enable() which will also deal
with disabling use_autosuspend for you and should help you
sort out some of the ordering.


> > +       pm_runtime_set_autosuspend_delay(&client->dev, 5000);
> > +       pm_runtime_use_autosuspend(&client->dev);
> > +
> > +       ltrf216a_set_power_state(data, true);  
> 
> The below code suggests that you are mixing badly devm_ with non-devm_
> APIs, don't do this. You have to group devm_ first followed by
> non-devm_ calls.
> 
> ...
> 
> > +static int ltrf216a_remove(struct i2c_client *client)
> > +{
> > +       struct iio_dev *indio_dev = i2c_get_clientdata(client);
> > +
> > +       iio_device_unregister(indio_dev);
> > +       pm_runtime_disable(&client->dev);
> > +       pm_runtime_set_suspended(&client->dev);
> > +       ltrf216a_disable(indio_dev);
> > +
> > +       return 0;  
> 
> I believe the ordering of freeing resources and reverting state is not
> in reverse. See above why.

In particular you are calling disable there which is already handled
by devm_ unwinding.
> 
> > +}  
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ