]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: freescale: ucc_geth: Return early when TBI PHY can't be found
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Wed, 14 Jan 2026 08:02:46 +0000 (09:02 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 16 Jan 2026 04:04:25 +0000 (20:04 -0800)
In ucc_geth's .mac_config(), we configure the TBI Serdes block represented by a
struct phy_device that we get from firmware.

While porting to phylink, a check was missed to make sure we don't try
to access the TBI PHY if we can't get it. Let's add it and return early
in case of error

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202601130843.rFGNXA5a-lkp@intel.com/
Fixes: 53036aa8d031 ("net: freescale: ucc_geth: phylink conversion")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260114080247.366252-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/ucc_geth.c

index affd5a6c44e7b32b4565cd1b0f37a67fff8ec693..131d1210dc4a84d9fdfc320a7a596d97c616f02b 100644 (file)
@@ -1602,8 +1602,10 @@ static void ugeth_mac_config(struct phylink_config *config, unsigned int mode,
                        pr_warn("TBI mode requires that the device tree specify a tbi-handle\n");
 
                tbiphy = of_phy_find_device(ug_info->tbi_node);
-               if (!tbiphy)
+               if (!tbiphy) {
                        pr_warn("Could not get TBI device\n");
+                       return;
+               }
 
                value = phy_read(tbiphy, ENET_TBI_MII_CR);
                value &= ~0x1000;       /* Turn off autonegotiation */