diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-08-13 02:34:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-17 10:50:54 -0400 |
commit | c0ca6d31a519682445e4c672b92f27ff7e0c5a7f (patch) | |
tree | 70f91382cb7bfe5dad2d270e7f277bcbb2a4f997 /drivers/iio/gyro/adis16136.c | |
parent | 42aceff5a26713a50239504ff30ce78beac66b6a (diff) |
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) | |||
497 | struct iio_dev *indio_dev; | 497 | struct iio_dev *indio_dev; |
498 | int ret; | 498 | int ret; |
499 | 499 | ||
500 | indio_dev = iio_device_alloc(sizeof(*adis16136)); | 500 | indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adis16136)); |
501 | if (indio_dev == NULL) | 501 | if (indio_dev == NULL) |
502 | return -ENOMEM; | 502 | return -ENOMEM; |
503 | 503 | ||
@@ -515,11 +515,11 @@ static int adis16136_probe(struct spi_device *spi) | |||
515 | 515 | ||
516 | ret = adis_init(&adis16136->adis, indio_dev, spi, &adis16136_data); | 516 | ret = adis_init(&adis16136->adis, indio_dev, spi, &adis16136_data); |
517 | if (ret) | 517 | if (ret) |
518 | goto error_free_dev; | 518 | return ret; |
519 | 519 | ||
520 | ret = adis_setup_buffer_and_trigger(&adis16136->adis, indio_dev, NULL); | 520 | ret = adis_setup_buffer_and_trigger(&adis16136->adis, indio_dev, NULL); |
521 | if (ret) | 521 | if (ret) |
522 | goto error_free_dev; | 522 | return ret; |
523 | 523 | ||
524 | ret = adis16136_initial_setup(indio_dev); | 524 | ret = adis16136_initial_setup(indio_dev); |
525 | if (ret) | 525 | if (ret) |
@@ -537,8 +537,6 @@ error_stop_device: | |||
537 | adis16136_stop_device(indio_dev); | 537 | adis16136_stop_device(indio_dev); |
538 | error_cleanup_buffer: | 538 | error_cleanup_buffer: |
539 | adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev); | 539 | adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev); |
540 | error_free_dev: | ||
541 | iio_device_free(indio_dev); | ||
542 | return ret; | 540 | return ret; |
543 | } | 541 | } |
544 | 542 | ||
@@ -552,8 +550,6 @@ static int adis16136_remove(struct spi_device *spi) | |||
552 | 550 | ||
553 | adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev); | 551 | adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev); |
554 | 552 | ||
555 | iio_device_free(indio_dev); | ||
556 | |||
557 | return 0; | 553 | return 0; |
558 | } | 554 | } |
559 | 555 | ||