From: John Williams <john.williams@petalogix.com>
To: John Linn <john.linn@xilinx.com>
Cc: netdev@vger.kernel.org, linuxppc-dev@ozlabs.org,
jgarzik@pobox.com, grant.likely@secretlab.ca,
jwboyer@linux.vnet.ibm.com,
Sadanand Mutyala <Sadanand.Mutyala@xilinx.com>
Subject: Re: [PATCH] [V3] net: emaclite: adding MDIO and phy lib support
Date: Wed, 10 Feb 2010 08:30:24 +1000 [thread overview]
Message-ID: <1d3f23371002091430hb550153u602c8e7c010381b9@mail.gmail.com> (raw)
In-Reply-To: <2ea396ca-3014-40f4-86ac-0e9f1aa82b5b@SG2EHSMHS005.ehs.local>
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:
> +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?
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
next prev parent reply other threads:[~2010-02-09 22:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-09 20:31 [PATCH] [V3] net: emaclite: adding MDIO and phy lib support John Linn
2010-02-09 22:30 ` John Williams [this message]
2010-02-09 22:38 ` John Linn
2010-02-09 23:00 ` John Linn
2010-02-10 1:53 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d3f23371002091430hb550153u602c8e7c010381b9@mail.gmail.com \
--to=john.williams@petalogix.com \
--cc=Sadanand.Mutyala@xilinx.com \
--cc=grant.likely@secretlab.ca \
--cc=jgarzik@pobox.com \
--cc=john.linn@xilinx.com \
--cc=jwboyer@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).