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, 9 Feb 2010 15:38:14 -0700
From:	John Linn <John.Linn@...inx.com>
To:	"John Williams" <john.williams@...alogix.com>
CC:	<netdev@...r.kernel.org>, <linuxppc-dev@...abs.org>,
	<jgarzik@...ox.com>, <grant.likely@...retlab.ca>,
	<jwboyer@...ux.vnet.ibm.com>,
	"Sadanand Mutyala" <sadanan@...inx.com>
Subject: RE: [PATCH] [V3] net: emaclite: adding MDIO and phy lib support

> -----Original Message-----
> From: John Williams [mailto:john.williams@...alogix.com]
> Sent: Tuesday, February 09, 2010 3:30 PM
> To: John Linn
> Cc: netdev@...r.kernel.org; linuxppc-dev@...abs.org; jgarzik@...ox.com; grant.likely@...retlab.ca;
> jwboyer@...ux.vnet.ibm.com; Sadanand Mutyala
> Subject: Re: [PATCH] [V3] net: emaclite: adding MDIO and phy lib support
> 
> Hi John,
> 
> Sorry If I'm painting bike-sheds here, just one tiny tweak might be in
> order to standardise your mutex_unlock exit path:

Hey John, I prefer burning down bike-sheds myself, fire and explosions are always more fun than painting :)

> 
> > +static int xemaclite_mdio_read(struct mii_bus *bus, int phy_id, int reg)
> > +{
> > +       struct net_local *lp = bus->priv;
> > +       u32 ctrl_reg;
> > +       u32 rc;
> > +
> > +       mutex_lock(&lp->mdio_mutex);
> > +
> > +       if (xemaclite_mdio_wait(lp)) {
> > +               mutex_unlock(&lp->mdio_mutex);
> > +               return -ETIMEDOUT;
> > +       }
> 
> [snip]
> 
> 
> > +       if (xemaclite_mdio_wait(lp)) {
> > +               mutex_unlock(&lp->mdio_mutex);
> > +               return -ETIMEDOUT;
> > +       }
> 
> [snip]
> 
> 
> > +       dev_dbg(&lp->ndev->dev,
> > +               "xemaclite_mdio_read(phy_id=%i, reg=%x) == %x\n",
> > +               phy_id, reg, rc);
> > +
> > +       return rc;
> 
> Can this be better expressed like this:
> 
> my_func() {
>   mutex_lock()
> ..
> 
>   if(some error) {
>     rc=-ETIMEDOUT;
>     goto out_unlock;
>   }
>   ...
> 
>   /* success path */
>   rc=0;
> ..
> out_unlock:
>   mutex_unlock()
>   return rc;
> }
> 
> 
> Is this style still favoured in driver exit paths?

I considered that and then blew it off (maybe shouldn't have).  

If we think it's a more std way to do it then no big deal.  I'll see if there are any other comments before spinning another maybe final patch.

Thanks for the input,
John


> 
> Thanks,
> 
> John
> --
> John Williams, PhD, B.Eng, B.IT
> PetaLogix - Linux Solutions for a Reconfigurable World
> w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ