public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded•com>
To: Florian Fainelli <f.fainelli@gmail•com>, netdev@vger•kernel.org
Cc: arnd@arndb•de
Subject: Re: [PATCH] pxa168_eth: fix mdiobus_scan() error check
Date: Sun, 1 May 2016 23:25:28 +0300	[thread overview]
Message-ID: <57266638.6030704@cogentembedded.com> (raw)
In-Reply-To: <57262956.3060206@gmail.com>

Hello.

On 05/01/2016 07:05 PM, Florian Fainelli wrote:

>> Since mdiobus_scan() returns either an error code or NULL on error, the
>> driver should check  for both,  not only for NULL, otherwise a crash is
>> imminent...
>>
>> Reported-by: Arnd Bergmann <arnd@arndb•de>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded•com>
>>
>> ---
>> The patch is against DaveM's 'net.git' repo.
>>
>>   drivers/net/ethernet/marvell/pxa168_eth.c |    2 ++
>>   1 file changed, 2 insertions(+)
>>
>> Index: net/drivers/net/ethernet/marvell/pxa168_eth.c
>> ===================================================================
>> --- net.orig/drivers/net/ethernet/marvell/pxa168_eth.c
>> +++ net/drivers/net/ethernet/marvell/pxa168_eth.c
>> @@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_de
>>   		return 0;
>>
>>   	pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
>> +	if (IS_ERR(pep->phy))
>> +		return PTR_ERR(pep->phy);
>>   	if (!pep->phy)
>>   		return -ENODEV;
>
> Should not this check be removed too and

    That's my next move -- for now I'm fixing the existing bug in this driver 
only.

> converted to a PTR_ERR(pep->phy) != -ENODEV?

    I don't see what that would achieve, IMO it's enough to just drop this 
*if* altogether.

MBR, Sergei

  reply	other threads:[~2016-05-01 20:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 22:09 [PATCH RFT v2 0/2] Teach phylib hard-resetting devices Sergei Shtylyov
2016-04-28 22:15 ` [PATCH RFT v2 2/2] macb: kill PHY reset code Sergei Shtylyov
2016-04-29  9:36   ` Nicolas Ferre
2016-04-30 20:35 ` [PATCH] pxa168_eth: fix mdiobus_scan() error check Sergei Shtylyov
2016-05-01 16:05   ` Florian Fainelli
2016-05-01 20:25     ` Sergei Shtylyov [this message]
2016-05-01 20:30       ` Sergei Shtylyov
2016-05-03 19:03   ` David Miller
2016-05-07 19:53 ` [PATCH] pxa168_eth: mdiobus_scan() doesn't return NULL anymore Sergei Shtylyov
2016-05-09  4:14   ` 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=57266638.6030704@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded$(echo .)com \
    --cc=arnd@arndb$(echo .)de \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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