iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
authorLee Jones <lee.jones@linaro.org>
Mon, 16 Sep 2013 16:02:00 +0000 (17:02 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 21 Sep 2013 18:24:04 +0000 (19:24 +0100)
Gets rid of those unnecessary gotos.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/st_sensors/st_sensors_core.c

index 32a56fda51fec4a012c8a7d069f4418cb3dd835e..7ba1ef27021323ec82ccb8a2cb3242795bfb0116 100644 (file)
@@ -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;
 }