Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:adc:ad7476: Fix remove handling

This driver was in an odd half way state between devm based cleanup
and manual cleanup (most of which was missing).
I would guess something went wrong with a rebase or similar.
Anyhow, this basically finishes the job as a precursor to improving
the regulator handling.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 4bb2b8f94ace3 ("iio: adc: ad7476: implement devm_add_action_or_reset")
Cc: Michael Hennerich <michael.hennerich@analog.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210401171759.318140-2-jic23@kernel.org

+4 -14
+4 -14
drivers/iio/adc/ad7476.c
··· 321 321 spi_message_init(&st->msg); 322 322 spi_message_add_tail(&st->xfer, &st->msg); 323 323 324 - ret = iio_triggered_buffer_setup(indio_dev, NULL, 325 - &ad7476_trigger_handler, NULL); 324 + ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL, 325 + &ad7476_trigger_handler, NULL); 326 326 if (ret) 327 - goto error_disable_reg; 327 + return ret; 328 328 329 329 if (st->chip_info->reset) 330 330 st->chip_info->reset(st); 331 331 332 - ret = iio_device_register(indio_dev); 333 - if (ret) 334 - goto error_ring_unregister; 335 - return 0; 336 - 337 - error_ring_unregister: 338 - iio_triggered_buffer_cleanup(indio_dev); 339 - error_disable_reg: 340 - regulator_disable(st->reg); 341 - 342 - return ret; 332 + return devm_iio_device_register(&spi->dev, indio_dev); 343 333 } 344 334 345 335 static const struct spi_device_id ad7476_id[] = {