Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1589665

[PATCH] drivers: net: xgene: Fix crash on DT systems

From Alban Bedel <alban.bedel@avionic-design.de>
Newsgroups linux.kernel
Subject [PATCH] drivers: net: xgene: Fix crash on DT systems
Date 2017-02-28 19:10 +0100
Message-ID <tfUnL-85M-17@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


On DT systems the driver require a clock, but the probe just print a
warning and continue, leading to a crash when resetting the device.
To fix this crash and properly handle probe deferals only ignore the
missing clock if DT isn't used or if the clock doesn't exist.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index d0d0d12b531f..68b48edc5921 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1756,6 +1756,12 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
 
 	pdata->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pdata->clk)) {
+		/* Abort if the clock is defined but couldn't be retrived.
+		 * Always abort if the clock is missing on DT system as
+		 * the driver can't cope with this case.
+		 */
+		if (PTR_ERR(pdata->clk) != -ENOENT || dev->of_node)
+			return PTR_ERR(pdata->clk);
 		/* Firmware may have set up the clock already. */
 		dev_info(dev, "clocks have been setup already\n");
 	}
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] drivers: net: xgene: Fix crash on DT systems Alban Bedel <alban.bedel@avionic-design.de> - 2017-02-28 19:10 +0100
  Re: [PATCH] drivers: net: xgene: Fix crash on DT systems Iyappan Subramanian <isubramanian@apm.com> - 2017-03-01 03:00 +0100
  Re: [PATCH] drivers: net: xgene: Fix crash on DT systems David Miller <davem@davemloft.net> - 2017-03-02 22:30 +0100

csiph-web