Re: [PATCH 13/20] iio: sensors-core: st: Clean-up error handlingin st_sensors_read_axis_data()

From: Jonathan Cameron
Date: Sat Sep 21 2013 - 07:51:45 EST


On 09/16/13 17:02, Lee Jones wrote:
> Gets rid of those unnecessary gotos.
>
> Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
Applied to the togreg branch of iio.git

Thanks Lee.
> ---
> drivers/iio/common/st_sensors/st_sensors_core.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index c5fbe58..76e573b 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -331,10 +331,8 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
> unsigned int byte_for_channel = ch->scan_type.storagebits >> 3;
>
> outdata = kmalloc(byte_for_channel, GFP_KERNEL);
> - if (!outdata) {
> - err = -EINVAL;
> - goto st_sensors_read_axis_data_error;
> - }
> + if (!outdata)
> + return -ENOMEM;
>
> err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
> ch->address, byte_for_channel,
> @@ -349,7 +347,7 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
>
> st_sensors_free_memory:
> kfree(outdata);
> -st_sensors_read_axis_data_error:
> +
> return err;
> }
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/