[PATCH 4/4] net: designware: add warning for drvdata

Steffen Trumtrar s.trumtrar at pengutronix.de
Wed Jan 10 00:14:20 PST 2018


Instead of silently using a wrong value, check if drvdata is defined
before use.
Print a warning if there is no drvdata found.

Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
---
 drivers/net/designware.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index ec20da09b388..862ee2f0463e 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -434,7 +434,11 @@ struct dw_eth_dev *dwc_drv_probe(struct device_d *dev)
 	if (ret)
 		return ERR_PTR(ret);
 
-	priv->enh_desc = drvdata->enh_desc;
+	if (drvdata && drvdata->enh_desc)
+		priv->enh_desc = drvdata->enh_desc;
+	else
+		dev_warn(dev, "No drvdata specified\n");
+
 
 	if (pdata) {
 		priv->phy_addr = pdata->phy_addr;
-- 
2.11.0




More information about the barebox mailing list