All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: i4l: act2000: Move assignment out of if statement
@ 2016-09-19 14:32 sayli karnik
  2016-09-19 14:35 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: sayli karnik @ 2016-09-19 14:32 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

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

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
---
 drivers/staging/i4l/act2000/module.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/i4l/act2000/module.c b/drivers/staging/i4l/act2000/module.c
index 68073d0..b862be5 100644
--- a/drivers/staging/i4l/act2000/module.c
+++ b/drivers/staging/i4l/act2000/module.c
@@ -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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: i4l: act2000: Move assignment out of if statement
  2016-09-19 14:32 [PATCH] staging: i4l: act2000: Move assignment out of if statement sayli karnik
@ 2016-09-19 14:35 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2016-09-19 14:35 UTC (permalink / raw)
  To: sayli karnik; +Cc: outreachy-kernel, gregkh



On Mon, 19 Sep 2016, sayli karnik wrote:

> 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
>
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

> ---
>  drivers/staging/i4l/act2000/module.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/i4l/act2000/module.c b/drivers/staging/i4l/act2000/module.c
> index 68073d0..b862be5 100644
> --- a/drivers/staging/i4l/act2000/module.c
> +++ b/drivers/staging/i4l/act2000/module.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-19 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 14:32 [PATCH] staging: i4l: act2000: Move assignment out of if statement sayli karnik
2016-09-19 14:35 ` [Outreachy kernel] " Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.