lkml.org 
[lkml]   [2014]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] net: cadence: macb: add support for the WOL
On 07/14/2014 07:49 PM, David Laight wrote:
> From: Varka Bhadram
>> On 07/14/2014 02:32 PM, Jongsung Kim wrote:
>>> This patch enables the ethtool utility to control the WOL function
>>> of the PHY connected to the GEM/MACB. (if supported)
> ...
>>> +static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
>>> +{
>>> + struct macb *bp = netdev_priv(netdev);
>>> + struct phy_device *phydev = bp->phy_dev;
>>> + int err = -ENODEV;
>>> +
>>> + if (phydev)
>>> + err = phy_ethtool_set_wol(phydev, wol);
>>> +
>>> + return err;
>>> +}
>>> +
>>
>> I think we can do in this way:
>>
>> if (phydev)
>> return phy_ethtool_set_wol(phydev, wol);
>> else
>> return -ENODEV;
>>
>>
>> we can save err. What do you say ...?
>
> I would do:
> if (!phydev)
> return -ENODEV;
> return phy_ethtool_set_wol(phydev, wol);
>
> Although it might even be worth moving the NULL test into the function.
> (sort of depends on style and the number of callers who need to do the test.)
>

Totally agreed. I'd be better to submit a patch about it first.

> David
>
>
>
>


\
 
 \ /
  Last update: 2014-07-15 09:41    [W:1.128 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site