All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	netdev@vger.kernel.org
Cc: arnd@arndb.de
Subject: Re: [PATCH] pxa168_eth: fix mdiobus_scan() error check
Date: Sun, 1 May 2016 09:05:42 -0700	[thread overview]
Message-ID: <57262956.3060206@gmail.com> (raw)
In-Reply-To: <6024241.YxM8l6DPJo@wasted.cogentembedded.com>

Le 30/04/2016 13:35, Sergei Shtylyov a écrit :
> 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 converted to a
PTR_ERR(pep->phy) != -ENODEV?
-- 
Florian

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

Thread overview: 11+ 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:09 ` 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 [this message]
2016-05-01 20:25     ` Sergei Shtylyov
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=57262956.3060206@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=arnd@arndb.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.