Skip to contentSkip to conversation

at91ether: return PTR_ERR if call to clk_get fails

PATCH Applied Devendra Naga 3 participants 3 messages Sep 20, 2012 – Sep 21, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 at91ether: return PTR_ERR if call to clk_get fails

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.

---
 drivers/net/ethernet/cadence/at91_ether.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/cadence/at91_ether.c +1 -1
index 7788419..4e980a7 100644
@@ -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);
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw

On 09/20/2012 09:04 AM, Devendra Naga :

Quoted 6 lines

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.

Thanks,

Quoted 18 lines
---
 drivers/net/ethernet/cadence/at91_ether.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/cadence/at91_ether.c +1 -1
index 7788419..4e980a7 100644
@@ -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);
Signature · 1 line
Nicolas Ferre
maintainer Applied
#2 lore raw

From: Nicolas Ferre <[email protected]>
Date: Thu, 20 Sep 2012 09:42:14 +0200

Quoted 9 lines

On 09/20/2012 09:04 AM, Devendra Naga :

Quoted 6 lines

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.

Applied, thanks.