Skip to contentSkip to conversation

Staging: netlogic: Compress return logic into one line

PATCH Superseded Mihaela Muraru 2 participants 2 messages Oct 13, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: netlogic: Compress return logic into one line

Simplify function returns by merging assignment and return into one command line.
Found with Coccinelle
@@
expression e, ret;
@@

-ret =
+return

        e;

-return ret;

---
 drivers/staging/netlogic/xlr_net.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/netlogic/xlr_net.c +1 -2
index 552a7dc..766969d 100644
@@ -1006,8 +1006,7 @@ static int xlr_net_probe(struct platform_device *pdev)
 	adapter = (struct xlr_adapter *)
 		devm_kzalloc(&pdev->dev, sizeof(*adapter), GFP_KERNEL);
 	if (!adapter) {
-		err = -ENOMEM;
-		return err;
+		return -ENOMEM;
 	}
 
 	/*
Signature · 1 line
2.7.4
#1 lore raw
Quoted 22 lines · Mihaela Muraru

Simplify function returns by merging assignment and return into one command line.
Found with Coccinelle
@@
expression e, ret;
@@

(quoted diff) +1 -2
-ret =
+return
        e;
-return ret;
---
 drivers/staging/netlogic/xlr_net.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/netlogic/xlr_net.c +0 -0
index 552a7dc..766969d 100644

drivers/staging/netlogic/xlr_net.c static int xlr_net_probe(struct platform_device *pdev) · line 1010

Quoted 7 lines
drivers/staging/netlogic/xlr_net.c +1 -2
@@ -1006,8 +1006,7 @@ static int xlr_net_probe(struct platform_device *pdev)
 	adapter = (struct xlr_adapter *)
 		devm_kzalloc(&pdev->dev, sizeof(*adapter), GFP_KERNEL);
 	if (!adapter) {
-		err = -ENOMEM;
-		return err;
+		return -ENOMEM;
 	}

Now there is only one statement in the if branch so the braces aren't needed.

julia

Quoted 12 lines
drivers/staging/netlogic/xlr_net.c +0 -1
 	/*
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161013163027.GA6040%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.