netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sfp: remove redundant NULL check
@ 2024-02-11 15:08 Daniil Dulov
  2024-02-13 12:43 ` Paolo Abeni
  2024-02-15 16:02 ` Russell King (Oracle)
  0 siblings, 2 replies; 5+ messages in thread
From: Daniil Dulov @ 2024-02-11 15:08 UTC (permalink / raw)
  To: Russell King
  Cc: Daniil Dulov, Andrew Lunn, Heiner Kallweit, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel, lvc-project

bus->upstream_ops in sfp_register_bus() cannot be NULL. So remove
redundant NULL check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices and sfp cages")
Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
---
 drivers/net/phy/sfp-bus.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index 850915a37f4c..829cb1dccc27 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -478,14 +478,12 @@ static int sfp_register_bus(struct sfp_bus *bus)
 	const struct sfp_upstream_ops *ops = bus->upstream_ops;
 	int ret;
 
-	if (ops) {
-		if (ops->link_down)
-			ops->link_down(bus->upstream);
-		if (ops->connect_phy && bus->phydev) {
-			ret = ops->connect_phy(bus->upstream, bus->phydev);
-			if (ret)
-				return ret;
-		}
+	if (ops->link_down)
+		ops->link_down(bus->upstream);
+	if (ops->connect_phy && bus->phydev) {
+		ret = ops->connect_phy(bus->upstream, bus->phydev);
+		if (ret)
+			return ret;
 	}
 	bus->registered = true;
 	bus->socket_ops->attach(bus->sfp);
-- 
2.25.1


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

end of thread, other threads:[~2024-02-15 17:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11 15:08 [PATCH] net: sfp: remove redundant NULL check Daniil Dulov
2024-02-13 12:43 ` Paolo Abeni
2024-02-14  1:26   ` Jakub Kicinski
2024-02-15 16:02 ` Russell King (Oracle)
2024-02-15 17:32   ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).