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]
Message-ID: <CAHp75Ve3+LsLA1x+zBLCxt7M3f1tL0bUquiG3o8-=0V3gs5_pw@mail.gmail.com>
Date: Mon, 29 May 2023 23:34:42 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>, Heiner Kallweit <hkallweit1@...il.com>, 
	Jiawen Wu <jiawenwu@...stnetic.com>, Maxime Chevallier <maxime.chevallier@...tlin.com>, 
	Simon Horman <simon.horman@...igine.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/6] net: mdio: add mdio_device_get() and mdio_device_put()

On Mon, May 29, 2023 at 6:21 PM Andrew Lunn <andrew@...n.ch> wrote:
> On Fri, May 26, 2023 at 09:20:17PM +0300, andy.shevchenko@...il.com wrote:
> > Fri, May 26, 2023 at 11:14:24AM +0100, Russell King (Oracle) kirjoitti:

...

> > > +static inline void mdio_device_get(struct mdio_device *mdiodev)
> > > +{
> > > +   get_device(&mdiodev->dev);
> >
> > Dunno what is the practice in net, but it makes sense to have the pattern as
> >
> >       if (mdiodev)
> >               return to_mdiodev(get_device(&mdiodev->dev));
> >
> > which might be helpful in some cases. This approach is used in many cases in
> > the kernel.
>
> The device should exist. If it does not, it is a bug, and the
> resulting opps will help find the bug.

The main point in the returned value, the 'if' can be dropped, it's
not a big deal.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ