All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: phy: propagate an error back to the callers of phy_sfp_probe
@ 2020-05-17 11:53 Leon Romanovsky
  2020-05-17 19:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2020-05-17 11:53 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Florian Fainelli,
	Heiner Kallweit
  Cc: Leon Romanovsky, netdev, Russell King

From: Leon Romanovsky <leonro@mellanox.com>

The compilation warning below reveals that the errors returned from
the sfp_bus_add_upstream() call are not propagated to the callers.
Fix it by returning "ret".

14:37:51 drivers/net/phy/phy_device.c: In function 'phy_sfp_probe':
14:37:51 drivers/net/phy/phy_device.c:1236:6: warning: variable 'ret'
   set but not used [-Wunused-but-set-variable]
14:37:51  1236 |  int ret;
14:37:51       |      ^~~

Fixes: 298e54fa810e ("net: phy: add core phylib sfp support")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/net/phy/phy_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ac2784192472..697c74deb222 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1233,7 +1233,7 @@ int phy_sfp_probe(struct phy_device *phydev,
 		  const struct sfp_upstream_ops *ops)
 {
 	struct sfp_bus *bus;
-	int ret;
+	int ret = 0;

 	if (phydev->mdio.dev.fwnode) {
 		bus = sfp_bus_find_fwnode(phydev->mdio.dev.fwnode);
@@ -1245,7 +1245,7 @@ int phy_sfp_probe(struct phy_device *phydev,
 		ret = sfp_bus_add_upstream(bus, phydev, ops);
 		sfp_bus_put(bus);
 	}
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(phy_sfp_probe);

--
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: phy: propagate an error back to the callers of phy_sfp_probe
  2020-05-17 11:53 [PATCH net] net: phy: propagate an error back to the callers of phy_sfp_probe Leon Romanovsky
@ 2020-05-17 19:44 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-05-17 19:44 UTC (permalink / raw)
  To: leon; +Cc: andrew, kuba, f.fainelli, hkallweit1, leonro, netdev, rmk+kernel

From: Leon Romanovsky <leon@kernel.org>
Date: Sun, 17 May 2020 14:53:40 +0300

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> The compilation warning below reveals that the errors returned from
> the sfp_bus_add_upstream() call are not propagated to the callers.
> Fix it by returning "ret".
> 
> 14:37:51 drivers/net/phy/phy_device.c: In function 'phy_sfp_probe':
> 14:37:51 drivers/net/phy/phy_device.c:1236:6: warning: variable 'ret'
>    set but not used [-Wunused-but-set-variable]
> 14:37:51  1236 |  int ret;
> 14:37:51       |      ^~~
> 
> Fixes: 298e54fa810e ("net: phy: add core phylib sfp support")
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-17 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 11:53 [PATCH net] net: phy: propagate an error back to the callers of phy_sfp_probe Leon Romanovsky
2020-05-17 19:44 ` David Miller

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.