Thread (10 messages) 10 messages, 4 authors, 2016-05-09

Re: [PATCH] pxa168_eth: fix mdiobus_scan() error check

From: Sergei Shtylyov <hidden>
Date: 2016-05-01 20:25:32

Hello.

On 05/01/2016 07:05 PM, Florian Fainelli wrote:
quoted
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 <redacted>

---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help