Skip to contentSkip to conversation

staging: i4l: act2000: Move assignment out of if statement

PATCH In review sayli karnik 2 participants 2 messages Sep 19, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: i4l: act2000: Move assignment out of if statement

This patch places assignments which are inside the if condition, above it. Done using coccinelle:

@@
statement s;
expression e;
identifier id;
@@
- if ((id = e))
+ id = e;
+ if (id)
s

---
 drivers/staging/i4l/act2000/module.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/i4l/act2000/module.c +2 -1
index 68073d0..b862be5 100644
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
 			if (copy_from_user(tmp, arg,
 					   sizeof(tmp)))
 				return -EFAULT;
-			if ((ret = act2000_set_msn(card, tmp)))
+			ret = act2000_set_msn(card, tmp);
+			if (ret)
 				return ret;
 			if (card->flags & ACT2000_FLAGS_RUNNING)
 				return (actcapi_manufacturer_req_msn(card));
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · sayli karnik

This patch places assignments which are inside the if condition, above it. Done using coccinelle:

@@
statement s;
expression e;
identifier id;
@@
- if ((id = e))
+ id = e;
+ if (id)
s

Quoted 1 line
Quoted 28 lines
---
 drivers/staging/i4l/act2000/module.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/i4l/act2000/module.c +2 -2
index 68073d0..b862be5 100644
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
 			if (copy_from_user(tmp, arg,
 					   sizeof(tmp)))
 				return -EFAULT;
-			if ((ret = act2000_set_msn(card, tmp)))
+			ret = act2000_set_msn(card, tmp);
+			if (ret)
 				return ret;
 			if (card->flags & ACT2000_FLAGS_RUNNING)
 				return (actcapi_manufacturer_req_msn(card));
--

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/20160919143240.GA30690%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.