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] [day] [month] [year] [list]
Message-ID: <1388897714.17770.3.camel@joe-AO722>
Date:	Sat, 04 Jan 2014 20:55:14 -0800
From:	Joe Perches <joe@...ches.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH v2 4/8] phy: kill useless local variables

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..,



--
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