[PATCH u-boot v2019.04-aspeed-openbmc 1/2] ftgmac100: Fail probe when NCSI selected but not enabled

Joel Stanley joel at jms.id.au
Thu Jul 14 15:07:43 AEST 2022


When NCSI has been selected by the device tree we will skip allocating a
phy bus in ftgmac100_mdio_init, resulting in a null pointer dereference
when calling phy_connect (in phy_find_by_mask).

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
 drivers/net/ftgmac100.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index aa1d63880c8c..16bab9705025 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -597,6 +597,12 @@ static int ftgmac100_probe(struct udevice *dev)
 		goto out;
 
 	if (priv->ncsi_mode) {
+		if (!IS_ENABLED(CONFIG_PHY_NCSI)) {
+			dev_err(dev,
+				"ftgmac100: NCSI in dts but CONFIG_PHY_NCSI missing. Please fix config\n");
+			return -EINVAL;
+		}
+
 		printf("%s - NCSI detected\n", __func__);
 	} else {
 		ret = ftgmac100_mdio_init(dev);
-- 
2.35.1



More information about the openbmc mailing list