[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240211150824.3947-1-d.dulov@aladdin.ru>
Date: Sun, 11 Feb 2024 07:08:24 -0800
From: Daniil Dulov <d.dulov@...ddin.ru>
To: Russell King <linux@...linux.org.uk>
CC: Daniil Dulov <d.dulov@...ddin.ru>, Andrew Lunn <andrew@...n.ch>, Heiner
Kallweit <hkallweit1@...il.com>, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] net: sfp: remove redundant NULL check
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@...ddin.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
Powered by blists - more mailing lists