[PATCH 2/2] net: fs_enet: Simplify code

Subsystems: freescale soc fs_enet driver, networking drivers, the rest

STALE3461d

2 messages, 2 authors, 2017-02-14 · open the first message on its own page

[PATCH 2/2] net: fs_enet: Simplify code

From: Christophe JAILLET <hidden>
Date: 2017-02-10 20:18:06

There is no need to use an intermediate variable to handle an error code
in this case.

Signed-off-by: Christophe JAILLET <redacted>
---
I think that the remaining use of 'err' a few lines above could also be
dropped. However, it could change the return value (i.e. propagation of the
error returned by 'of_phy_register_fixed_link' instead of -ENODEV) and I'm
unsure it would be correct. So I leave it as-is.
---
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 5c6426756d11..753259091b22 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -964,11 +964,10 @@ static int fs_enet_probe(struct platform_device *ofdev)
 	 */
 	clk = devm_clk_get(&ofdev->dev, "per");
 	if (!IS_ERR(clk)) {
-		err = clk_prepare_enable(clk);
-		if (err) {
-			ret = err;
+		ret = clk_prepare_enable(clk);
+		if (ret)
 			goto out_deregister_fixed_link;
-		}
+
 		fpi->clk_per = clk;
 	}
 
-- 
2.9.3

Re: [PATCH 2/2] net: fs_enet: Simplify code

From: David Miller <davem@davemloft.net>
Date: 2017-02-14 03:12:44

From: Christophe JAILLET <redacted>
Date: Fri, 10 Feb 2017 21:17:19 +0100
There is no need to use an intermediate variable to handle an error code
in this case.

Signed-off-by: Christophe JAILLET <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help