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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jHWF2q550pAo+s2s+dN+FLKAQ8yzY9d1p1Ww3t116pzA@mail.gmail.com>
Date:   Mon, 12 Apr 2021 20:12:38 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Dwaipayan Ray <dwaipayanray1@...il.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" <devel@...ica.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        Robert Moore <robert.moore@...el.com>,
        Erik Kaneda <erik.kaneda@...el.com>
Subject: Re: [PATCH v1 1/1] ACPI: bus: Introduce acpi_dev_get() and reuse it
 in ACPI code

On Mon, Apr 12, 2021 at 8:10 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Mon, Apr 12, 2021 at 9:05 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
> >
> > On Mon, Apr 12, 2021 at 7:47 PM Andy Shevchenko
> > <andy.shevchenko@...il.com> wrote:
> > >
> > > On Mon, Apr 12, 2021 at 8:32 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
> > > > On Sat, Apr 10, 2021 at 3:47 PM Andy Shevchenko
> > > > <andy.shevchenko@...il.com> wrote:
> > >
> > > ...
> > >
> > > > >  static void get_acpi_device(void *dev)
> > > > >  {
> > > > > -       if (dev)
> > > > > -               get_device(&((struct acpi_device *)dev)->dev);
> > > > > +       acpi_dev_get(dev);
> > > >
> > > > I would do
> > > >
> > > > if (dev)
> > > >     acpi_dev_get(dev);
> > > >
> > > > here.
> > >
> > > Hmm... I don't see a point. acpi_dev_get() guaranteed to perform this check.
> > >
> > > > >  }
> > >
> > >
> > > > > +static inline void acpi_dev_get(struct acpi_device *adev)
> > > > > +{
> > > > > +       if (adev)
> > > > > +               get_device(&adev->dev);
> > > >
> > > > And I would drop the adev check from here (because the code calling it
> > > > may be running with wrong assumptions if adev is NULL).  Or it should
> > > > return adev and the caller should be held responsible for checking it
> > > > against NULL (if they care).
> > >
> > > But this follows the get_device() / put_device() logic.
> >
> > Not really.  get_device() returns a pointer.
> >
> > > Personally I don't think this is a good idea to deviate.
> >
> > Well, exactly. :-)
> >
> > > Note the acpi_bus_get_acpi_device()
> >
> > This also returns a pointer.
>
> Is it okay to return a pointer in acpi_dev_get() then?

Yes, it is, as I've said already.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ