diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-07-30 09:44:00 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 18:55:24 +0100 |
commit | 297c8876d9669dfa6d6a4c17bd4527495036f64f (patch) | |
tree | 5d77f4dfa8d5d41c50b6973dfdc4204f7e967b98 /drivers/iio | |
parent | 5b778b97d494653deb2f2320393900ee51c80894 (diff) | |
download | linux-stable-297c8876d9669dfa6d6a4c17bd4527495036f64f.tar.gz linux-stable-297c8876d9669dfa6d6a4c17bd4527495036f64f.tar.bz2 linux-stable-297c8876d9669dfa6d6a4c17bd4527495036f64f.zip |
iio: imu: adis16480: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/imu/adis16480.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c index b7db38376295..dd4206cac62d 100644 --- a/drivers/iio/imu/adis16480.c +++ b/drivers/iio/imu/adis16480.c @@ -839,7 +839,7 @@ static int adis16480_probe(struct spi_device *spi) struct adis16480 *st; int ret; - indio_dev = iio_device_alloc(sizeof(*st)); + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); if (indio_dev == NULL) return -ENOMEM; @@ -857,11 +857,11 @@ static int adis16480_probe(struct spi_device *spi) ret = adis_init(&st->adis, indio_dev, spi, &adis16480_data); if (ret) - goto error_free_dev; + return ret; ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); if (ret) - goto error_free_dev; + return ret; ret = adis16480_initial_setup(indio_dev); if (ret) @@ -879,8 +879,6 @@ error_stop_device: adis16480_stop_device(indio_dev); error_cleanup_buffer: adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); -error_free_dev: - iio_device_free(indio_dev); return ret; } @@ -894,8 +892,6 @@ static int adis16480_remove(struct spi_device *spi) adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); - iio_device_free(indio_dev); - return 0; } |