summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-08-19 13:38:00 +0200
committerJonathan Cameron <jic23@kernel.org>2013-08-19 21:38:50 +0200
commitcc566fd5e52d64554d294b4d36f9d593cbe797d5 (patch)
treee43294bfeb286a9ec219116c76625808574687bd /drivers/iio
parentiio: dac: ad7303: Use devm_* APIs (diff)
downloadlinux-cc566fd5e52d64554d294b4d36f9d593cbe797d5.tar.xz
linux-cc566fd5e52d64554d294b4d36f9d593cbe797d5.zip
iio: dac: max517: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Roland Stigge <stigge@antcom.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/dac/max517.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
index ebfaa4156246..83adcbf1a205 100644
--- a/drivers/iio/dac/max517.c
+++ b/drivers/iio/dac/max517.c
@@ -164,11 +164,9 @@ static int max517_probe(struct i2c_client *client,
struct max517_platform_data *platform_data = client->dev.platform_data;
int err;
- indio_dev = iio_device_alloc(sizeof(*data));
- if (indio_dev == NULL) {
- err = -ENOMEM;
- goto exit;
- }
+ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
+ if (!indio_dev)
+ return -ENOMEM;
data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
data->client = client;
@@ -198,23 +196,16 @@ static int max517_probe(struct i2c_client *client,
err = iio_device_register(indio_dev);
if (err)
- goto exit_free_device;
+ return err;
dev_info(&client->dev, "DAC registered\n");
return 0;
-
-exit_free_device:
- iio_device_free(indio_dev);
-exit:
- return err;
}
static int max517_remove(struct i2c_client *client)
{
iio_device_unregister(i2c_get_clientdata(client));
- iio_device_free(i2c_get_clientdata(client));
-
return 0;
}