]> git.baikalelectronics.ru Git - kernel.git/commit
net: stmmac: fix invalid call to mdiobus_get_phy()
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 15 Jan 2023 17:24:08 +0000 (18:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Feb 2023 06:52:38 +0000 (07:52 +0100)
commit7057f435302e556e4a888e16f4a0988522d2e868
tree2cb82a63181fda9354e8efeca5e5ba563414f388
parent3b26adf3cc20c628a336c82994332debe9411cda
net: stmmac: fix invalid call to mdiobus_get_phy()

[ Upstream commit 1f3bd64ad921f051254591fbed04fd30b306cde6 ]

In a number of cases the driver assigns a default value of -1 to
priv->plat->phy_addr. This may result in calling mdiobus_get_phy()
with addr parameter being -1. Therefore check for this scenario and
bail out before calling mdiobus_get_phy().

Fixes: e08a56c85e3d ("net: stmmac: Fix case when PHY handle is not present")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/669f9671-ecd1-a41b-2727-7b73e3003985@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c