[PATCH] at91ether: return PTR_ERR if call to clk_get fails

Subsystems: atmel macb ethernet driver, networking drivers, the rest

STALE5076d

3 messages, 3 authors, 2012-09-21 · open the first message on its own page

[PATCH] at91ether: return PTR_ERR if call to clk_get fails

From: Devendra Naga <hidden>
Date: 2012-09-20 07:04:45

we are currently returning ENODEV, as the clk_get may give a exact
error code in its returned pointer, assign it to the ret by using the
PTR_ERR function, so that the subsequent goto label will jump to the
error path and clean the driver and return the error correctly.

Signed-off-by: Devendra Naga <redacted>
---
 drivers/net/ethernet/cadence/at91_ether.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 7788419..4e980a7 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -1086,7 +1086,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	/* Clock */
 	lp->ether_clk = clk_get(&pdev->dev, "ether_clk");
 	if (IS_ERR(lp->ether_clk)) {
-		res = -ENODEV;
+		res = PTR_ERR(lp->ether_clk);
 		goto err_ioumap;
 	}
 	clk_enable(lp->ether_clk);
-- 
1.7.1

[PATCH] at91ether: return PTR_ERR if call to clk_get fails

From: Nicolas Ferre <hidden>
Date: 2012-09-20 07:42:14

On 09/20/2012 09:04 AM, Devendra Naga :
we are currently returning ENODEV, as the clk_get may give a exact
error code in its returned pointer, assign it to the ret by using the
PTR_ERR function, so that the subsequent goto label will jump to the
error path and clean the driver and return the error correctly.

Signed-off-by: Devendra Naga <redacted>
Acked-by: Nicolas Ferre <redacted>

Thanks,
quoted hunk
---
 drivers/net/ethernet/cadence/at91_ether.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 7788419..4e980a7 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -1086,7 +1086,7 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	/* Clock */
 	lp->ether_clk = clk_get(&pdev->dev, "ether_clk");
 	if (IS_ERR(lp->ether_clk)) {
-		res = -ENODEV;
+		res = PTR_ERR(lp->ether_clk);
 		goto err_ioumap;
 	}
 	clk_enable(lp->ether_clk);

-- 
Nicolas Ferre

[PATCH] at91ether: return PTR_ERR if call to clk_get fails

From: davem@davemloft.net (David Miller)
Date: 2012-09-21 02:22:21

From: Nicolas Ferre <redacted>
Date: Thu, 20 Sep 2012 09:42:14 +0200
On 09/20/2012 09:04 AM, Devendra Naga :
quoted
we are currently returning ENODEV, as the clk_get may give a exact
error code in its returned pointer, assign it to the ret by using the
PTR_ERR function, so that the subsequent goto label will jump to the
error path and clean the driver and return the error correctly.

Signed-off-by: Devendra Naga <redacted>
Acked-by: Nicolas Ferre <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help