diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-08-13 10:34:00 +0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-17 18:50:54 +0400 |
commit | c0ca6d31a519682445e4c672b92f27ff7e0c5a7f (patch) | |
tree | 70f91382cb7bfe5dad2d270e7f277bcbb2a4f997 /drivers/iio/gyro/adis16136.c | |
parent | 42aceff5a26713a50239504ff30ce78beac66b6a (diff) | |
download | linux-c0ca6d31a519682445e4c672b92f27ff7e0c5a7f.tar.xz |
iio: gyro: adis16136: 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/gyro/adis16136.c')
-rw-r--r-- | drivers/iio/gyro/adis16136.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c index 058e6d5c955f..591bd555e1f3 100644 --- a/drivers/iio/gyro/adis16136.c +++ b/drivers/iio/gyro/adis16136.c @@ -497,7 +497,7 @@ static int adis16136_probe(struct spi_device *spi) struct iio_dev *indio_dev; int ret; - indio_dev = iio_device_alloc(sizeof(*adis16136)); + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adis16136)); if (indio_dev == NULL) return -ENOMEM; @@ -515,11 +515,11 @@ static int adis16136_probe(struct spi_device *spi) ret = adis_init(&adis16136->adis, indio_dev, spi, &adis16136_data); if (ret) - goto error_free_dev; + return ret; ret = adis_setup_buffer_and_trigger(&adis16136->adis, indio_dev, NULL); if (ret) - goto error_free_dev; + return ret; ret = adis16136_initial_setup(indio_dev); if (ret) @@ -537,8 +537,6 @@ error_stop_device: adis16136_stop_device(indio_dev); error_cleanup_buffer: adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev); -error_free_dev: - iio_device_free(indio_dev); return ret; } @@ -552,8 +550,6 @@ static int adis16136_remove(struct spi_device *spi) adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev); - iio_device_free(indio_dev); - return 0; } |