From: Joe Perches <joe@perches.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2 4/8] phy: kill useless local variables
Date: Sat, 04 Jan 2014 20:55:14 -0800 [thread overview]
Message-ID: <1388897714.17770.3.camel@joe-AO722> (raw)
In-Reply-To: <201401050321.52499.sergei.shtylyov@cogentembedded.com>
On Sun, 2014-01-05 at 03:21 +0300, Sergei Shtylyov wrote:
> A number of functions (especially in phy.c) has local variables that were hardly
> needed in the first place -- remove them.
[]
> +++ net-next/drivers/net/phy/phy.c
> @@ -67,12 +67,10 @@ EXPORT_SYMBOL(phy_print_status);
> */
> static int phy_clear_interrupt(struct phy_device *phydev)
> {
> - int err = 0;
> -
> if (phydev->drv->ack_interrupt)
> - err = phydev->drv->ack_interrupt(phydev);
> + return phydev->drv->ack_interrupt(phydev);
>
> - return err;
> + return 0;
> }
My preference for this sort of conversion would be to
make the generic return at the bottom of the block like:
static int phy_clear_interrupt(struct phy_device *phydev)
{
if (!phydev->drv->ack_interrupt)
return 0;
return phydev->drv->ack_interrupt(phydev);
}
> @@ -84,13 +82,11 @@ static int phy_clear_interrupt(struct ph
> */
> static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
> {
> - int err = 0;
> -
> phydev->interrupts = interrupts;
> if (phydev->drv->config_intr)
> - err = phydev->drv->config_intr(phydev);
> + return phydev->drv->config_intr(phydev);
>
> - return err;
> + return 0;
> }
etc..,
next prev parent reply other threads:[~2014-01-05 4:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-05 0:15 [PATCH v2 0/6] phylib: cleanups Sergei Shtylyov
2014-01-05 0:17 ` [PATCH v2 1/8] phy: coding style fixes Sergei Shtylyov
2014-01-05 0:18 ` [PATCH v2 2/8] mdio_bus: " Sergei Shtylyov
2014-01-05 0:20 ` [PATCH v2 3/8] <linux/phy.h>: " Sergei Shtylyov
2014-01-05 0:21 ` [PATCH v2 4/8] phy: kill useless local variables Sergei Shtylyov
2014-01-05 4:55 ` Joe Perches [this message]
2014-01-05 0:23 ` [PATCH v2 5/8] phy: kill excess code Sergei Shtylyov
2014-01-05 0:24 ` [PATCH v2 6/8] phy: kill excess empty lines Sergei Shtylyov
2014-01-05 0:27 ` [PATCH v2 7/8] phylib: remove unused adjust_state() callback Sergei Shtylyov
2014-01-05 0:28 ` [PATCH v2 8/8] phylib: make phy_scan_fixups() static Sergei Shtylyov
2014-01-05 0:39 ` [PATCH v2 0/6] phylib: cleanups David Miller
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=1388897714.17770.3.camel@joe-AO722 \
--to=joe@perches.com \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
/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