diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-07-30 04:44:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 13:55:24 -0400 |
commit | 297c8876d9669dfa6d6a4c17bd4527495036f64f (patch) | |
tree | 5d77f4dfa8d5d41c50b6973dfdc4204f7e967b98 /drivers/iio/imu | |
parent | 5b778b97d494653deb2f2320393900ee51c80894 (diff) |
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/imu')
-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) | |||
839 | struct adis16480 *st; | 839 | struct adis16480 *st; |
840 | int ret; | 840 | int ret; |
841 | 841 | ||
842 | indio_dev = iio_device_alloc(sizeof(*st)); | 842 | indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); |
843 | if (indio_dev == NULL) | 843 | if (indio_dev == NULL) |
844 | return -ENOMEM; | 844 | return -ENOMEM; |
845 | 845 | ||
@@ -857,11 +857,11 @@ static int adis16480_probe(struct spi_device *spi) | |||
857 | 857 | ||
858 | ret = adis_init(&st->adis, indio_dev, spi, &adis16480_data); | 858 | ret = adis_init(&st->adis, indio_dev, spi, &adis16480_data); |
859 | if (ret) | 859 | if (ret) |
860 | goto error_free_dev; | 860 | return ret; |
861 | 861 | ||
862 | ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); | 862 | ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); |
863 | if (ret) | 863 | if (ret) |
864 | goto error_free_dev; | 864 | return ret; |
865 | 865 | ||
866 | ret = adis16480_initial_setup(indio_dev); | 866 | ret = adis16480_initial_setup(indio_dev); |
867 | if (ret) | 867 | if (ret) |
@@ -879,8 +879,6 @@ error_stop_device: | |||
879 | adis16480_stop_device(indio_dev); | 879 | adis16480_stop_device(indio_dev); |
880 | error_cleanup_buffer: | 880 | error_cleanup_buffer: |
881 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); | 881 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); |
882 | error_free_dev: | ||
883 | iio_device_free(indio_dev); | ||
884 | return ret; | 882 | return ret; |
885 | } | 883 | } |
886 | 884 | ||
@@ -894,8 +892,6 @@ static int adis16480_remove(struct spi_device *spi) | |||
894 | 892 | ||
895 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); | 893 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); |
896 | 894 | ||
897 | iio_device_free(indio_dev); | ||
898 | |||
899 | return 0; | 895 | return 0; |
900 | } | 896 | } |
901 | 897 | ||