All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: compress return logic
@ 2017-02-17 17:17 Gargi Sharma
  2017-02-17 17:53 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Gargi Sharma @ 2017-02-17 17:17 UTC (permalink / raw)
  To: outreachy-kernel
  Cc: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh, Gargi Sharma

Simplify function returns by merging assignment and return.
Found with Coccinelle.

Semantic patch:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
---
 drivers/staging/iio/meter/ade7854.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c
index e8007f0..c6cffc1 100644
--- a/drivers/staging/iio/meter/ade7854.c
+++ b/drivers/staging/iio/meter/ade7854.c
@@ -426,9 +426,7 @@ static int ade7854_set_irq(struct device *dev, bool enable)
 	else
 		irqen &= ~BIT(17);
 
-	ret = st->write_reg_32(dev, ADE7854_MASK0, irqen);
-
-	return ret;
+	return st->write_reg_32(dev, ADE7854_MASK0, irqen);
 }
 
 static int ade7854_initial_setup(struct iio_dev *indio_dev)
-- 
2.7.4



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

* Re: [Outreachy kernel] [PATCH] staging: iio: compress return logic
  2017-02-17 17:17 [PATCH] staging: iio: compress return logic Gargi Sharma
@ 2017-02-17 17:53 ` Julia Lawall
  2017-02-18 19:00   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2017-02-17 17:53 UTC (permalink / raw)
  To: Gargi Sharma
  Cc: outreachy-kernel, lars, Michael.Hennerich, jic23, knaack.h,
	pmeerw, gregkh



On Fri, 17 Feb 2017, Gargi Sharma wrote:

> Simplify function returns by merging assignment and return.
> Found with Coccinelle.
>
> Semantic patch:
> @@
> local idexpression ret;
> expression e;
> @@
>
> -ret =
> +return
>      e;
> -return ret;
>
> Signed-off-by: Gargi Sharma <gs051095@gmail.com>

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

> ---
>  drivers/staging/iio/meter/ade7854.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c
> index e8007f0..c6cffc1 100644
> --- a/drivers/staging/iio/meter/ade7854.c
> +++ b/drivers/staging/iio/meter/ade7854.c
> @@ -426,9 +426,7 @@ static int ade7854_set_irq(struct device *dev, bool enable)
>  	else
>  		irqen &= ~BIT(17);
>
> -	ret = st->write_reg_32(dev, ADE7854_MASK0, irqen);
> -
> -	return ret;
> +	return st->write_reg_32(dev, ADE7854_MASK0, irqen);
>  }
>
>  static int ade7854_initial_setup(struct iio_dev *indio_dev)
> --
> 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/1487351841-6639-1-git-send-email-gs051095%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] [PATCH] staging: iio: compress return logic
  2017-02-17 17:53 ` [Outreachy kernel] " Julia Lawall
@ 2017-02-18 19:00   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2017-02-18 19:00 UTC (permalink / raw)
  To: Julia Lawall, Gargi Sharma
  Cc: outreachy-kernel, lars, Michael.Hennerich, knaack.h, pmeerw, gregkh

On 17/02/17 17:53, Julia Lawall wrote:
> 
> 
> On Fri, 17 Feb 2017, Gargi Sharma wrote:
> 
>> Simplify function returns by merging assignment and return.
>> Found with Coccinelle.
>>
>> Semantic patch:
>> @@
>> local idexpression ret;
>> expression e;
>> @@
>>
>> -ret =
>> +return
>>      e;
>> -return ret;
>>
>> Signed-off-by: Gargi Sharma <gs051095@gmail.com>
> 
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to
play with it.

Thanks,

Jonathan
> 
>> ---
>>  drivers/staging/iio/meter/ade7854.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c
>> index e8007f0..c6cffc1 100644
>> --- a/drivers/staging/iio/meter/ade7854.c
>> +++ b/drivers/staging/iio/meter/ade7854.c
>> @@ -426,9 +426,7 @@ static int ade7854_set_irq(struct device *dev, bool enable)
>>  	else
>>  		irqen &= ~BIT(17);
>>
>> -	ret = st->write_reg_32(dev, ADE7854_MASK0, irqen);
>> -
>> -	return ret;
>> +	return st->write_reg_32(dev, ADE7854_MASK0, irqen);
>>  }
>>
>>  static int ade7854_initial_setup(struct iio_dev *indio_dev)
>> --
>> 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/1487351841-6639-1-git-send-email-gs051095%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>



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

end of thread, other threads:[~2017-02-18 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 17:17 [PATCH] staging: iio: compress return logic Gargi Sharma
2017-02-17 17:53 ` [Outreachy kernel] " Julia Lawall
2017-02-18 19:00   ` Jonathan Cameron

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.