iio: adc: ad7298: convert probe to device-managed functions
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Fri, 27 Nov 2020 09:40:37 +0000 (11:40 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 28 Nov 2020 13:03:28 +0000 (13:03 +0000)
commitb6a3f8326cfddad455d832d4ff9392286280a31c
tree78f5a40f63001a844979224d21fb6ecd7c436a32
parent617e38a25cbdd672141afff93b1827a99338f502
iio: adc: ad7298: convert probe to device-managed functions

This change converts the probe of this driver to use device-managed
register functions, and a devm_add_action_or_reset() for the regulator
disable.

With this, the exit & error paths can be removed.
Another side-effect is that this should avoid some static-analyzer's check
with respect to a potential null dereference of the regulator. The null
dereference isn't likely to happen (under normal operation), so there isn't
a requirement to have this fixed/backported in other releases.

As a note: this is removing spi_set_drvdata() since there is no other
spi_get_drvdata() (or dev_get_drvdata()) call that need it.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201127094038.91714-1-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7298.c