net: phy: simplify mdiobus_setup_mdiodev_from_board_info

- Move declaration of variable bi into list_for_each_entry_safe()
- The return value of cb() effectively isn't used, this allows to simplify
  the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/f6bbe242-b43d-4c2b-8c51-2cb2cefbaf59@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Heiner Kallweit
2025-06-11 22:09:36 +02:00
committed by Jakub Kicinski
parent 08207f42d3
commit 0893bf6bb4

View File

@@ -26,24 +26,18 @@ void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus,
(struct mii_bus *bus,
struct mdio_board_info *bi))
{
struct mdio_board_entry *be;
struct mdio_board_entry *tmp;
struct mdio_board_info *bi;
int ret;
struct mdio_board_entry *be, *tmp;
mutex_lock(&mdio_board_lock);
list_for_each_entry_safe(be, tmp, &mdio_board_list, list) {
bi = &be->board_info;
struct mdio_board_info *bi = &be->board_info;
if (strcmp(bus->id, bi->bus_id))
continue;
mutex_unlock(&mdio_board_lock);
ret = cb(bus, bi);
cb(bus, bi);
mutex_lock(&mdio_board_lock);
if (ret)
continue;
}
mutex_unlock(&mdio_board_lock);
}