From: Lee Jones Date: Mon, 16 Sep 2013 16:02:00 +0000 (+0100) Subject: iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data() X-Git-Tag: firefly_0821_release~176^2~5057^2~694^2~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=caf5ca122b6b4c2da62949538604f1dabe6f34e8;p=firefly-linux-kernel-4.4.55.git iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data() Gets rid of those unnecessary gotos. Signed-off-by: Lee Jones Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 32a56fda51fe..7ba1ef270213 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; }