2014-12-26 23:09:07

by Fengguang Wu

[permalink] [raw]
Subject: [PATCH] iio: imu: kmx61: fix simple_return.cocci warnings

drivers/iio/imu/kmx61.c:543:1-4: WARNING: end returns can be simpified
drivers/iio/imu/kmx61.c:480:1-4: WARNING: end returns can be simpified if negative or 0 value

Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

CC: Daniel Baluta <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
---

kmx61.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -540,11 +540,7 @@ static int kmx61_setup_new_data_interrup
return ret;
}

- ret = kmx61_set_mode(data, mode, KMX61_ACC | KMX61_MAG, true);
- if (ret)
- return ret;
-
- return 0;
+ return kmx61_set_mode(data, mode, KMX61_ACC | KMX61_MAG, true);
}

/**


2014-12-27 08:05:42

by Daniel Baluta

[permalink] [raw]
Subject: Re: [PATCH] iio: imu: kmx61: fix simple_return.cocci warnings

On Sat, Dec 27, 2014 at 1:07 AM, kbuild test robot
<[email protected]> wrote:
> drivers/iio/imu/kmx61.c:543:1-4: WARNING: end returns can be simpified
> drivers/iio/imu/kmx61.c:480:1-4: WARNING: end returns can be simpified if negative or 0 value
>
> Simplify a trivial if-return sequence. Possibly combine with a
> preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
>
> CC: Daniel Baluta <[email protected]>
> Signed-off-by: Fengguang Wu <[email protected]>
> ---
>
> kmx61.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> --- a/drivers/iio/imu/kmx61.c
> +++ b/drivers/iio/imu/kmx61.c
> @@ -540,11 +540,7 @@ static int kmx61_setup_new_data_interrup
> return ret;
> }
>
> - ret = kmx61_set_mode(data, mode, KMX61_ACC | KMX61_MAG, true);
> - if (ret)
> - return ret;
> -
> - return 0;
> + return kmx61_set_mode(data, mode, KMX61_ACC | KMX61_MAG, true);
> }
>
> /**

Fixed with this patch:

http://marc.info/?l=linux-iio&m=141934100614777&w=2

Daniel.