linux/drivers/net/ethernet/ti
Siddharth Vadapalli b29e7b24de net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe
[ Upstream commit c6b486fb33 ]

In the am65_cpsw_nuss_probe() function's cleanup path, the call to
of_platform_device_destroy() for the common->mdio_dev device is invoked
unconditionally. It is possible that either the MDIO node is not present
in the device-tree, or the MDIO node is disabled in the device-tree. In
both these cases, the MDIO device is not created, resulting in a NULL
pointer dereference when the of_platform_device_destroy() function is
invoked on the common->mdio_dev device on the cleanup path.

Fix this by ensuring that the common->mdio_dev device exists, before
attempting to invoke of_platform_device_destroy().

Fixes: a45cfcc69a ("net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20230403090321.835877-1-s-vadapalli@ti.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-13 16:55:22 +02:00
..
am65-cpsw-ethtool.c
am65-cpsw-nuss.c
am65-cpsw-nuss.h
am65-cpsw-qos.c
am65-cpsw-qos.h
am65-cpsw-switchdev.c
am65-cpsw-switchdev.h
am65-cpts.c
am65-cpts.h
cpmac.c
cpsw_ale.c
cpsw_ale.h
cpsw_ethtool.c
cpsw_new.c
cpsw_priv.c
cpsw_priv.h
cpsw_sl.c
cpsw_sl.h
cpsw_switchdev.c
cpsw_switchdev.h
cpsw-common.c
cpsw-phy-sel.c
cpsw.c
cpsw.h
cpts.c
cpts.h
davinci_cpdma.c
davinci_cpdma.h
davinci_emac.c
davinci_mdio.c
k3-cppi-desc-pool.c
k3-cppi-desc-pool.h
Kconfig
Makefile
netcp_core.c
netcp_ethss.c
netcp_sgmii.c
netcp_xgbepcsr.c
netcp.h
tlan.c
tlan.h