Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 297c8876 authored by Sachin Kamat's avatar Sachin Kamat Committed by Jonathan Cameron
Browse files

iio: imu: adis16480: Use devm_iio_device_alloc



Using devm_iio_device_alloc makes code simpler.

Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 5b778b97
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -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 @@ static int adis16480_probe(struct spi_device *spi)
	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;
}