diff options
author | Peter Meerwald <pmeerw@pmeerw.net> | 2013-07-29 18:18:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 17:17:02 -0400 |
commit | ccf12c3310b489c39e78a3fc06c9ef15a4570078 (patch) | |
tree | 315fc87e4e34e58cc68ae24d593f583691a5e18b /drivers/iio | |
parent | d0fe8c8b3b683979f31dfe2ebba6bb1eade21ccd (diff) |
iio:adjd_s311: Use devm_iio_device_alloc
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/light/adjd_s311.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c index 5f4749e60b04..55b9e185d164 100644 --- a/drivers/iio/light/adjd_s311.c +++ b/drivers/iio/light/adjd_s311.c | |||
@@ -293,11 +293,10 @@ static int adjd_s311_probe(struct i2c_client *client, | |||
293 | struct iio_dev *indio_dev; | 293 | struct iio_dev *indio_dev; |
294 | int err; | 294 | int err; |
295 | 295 | ||
296 | indio_dev = iio_device_alloc(sizeof(*data)); | 296 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); |
297 | if (indio_dev == NULL) { | 297 | if (indio_dev == NULL) |
298 | err = -ENOMEM; | 298 | return -ENOMEM; |
299 | goto exit; | 299 | |
300 | } | ||
301 | data = iio_priv(indio_dev); | 300 | data = iio_priv(indio_dev); |
302 | i2c_set_clientdata(client, indio_dev); | 301 | i2c_set_clientdata(client, indio_dev); |
303 | data->client = client; | 302 | data->client = client; |
@@ -312,7 +311,7 @@ static int adjd_s311_probe(struct i2c_client *client, | |||
312 | err = iio_triggered_buffer_setup(indio_dev, NULL, | 311 | err = iio_triggered_buffer_setup(indio_dev, NULL, |
313 | adjd_s311_trigger_handler, NULL); | 312 | adjd_s311_trigger_handler, NULL); |
314 | if (err < 0) | 313 | if (err < 0) |
315 | goto exit_free_device; | 314 | return err; |
316 | 315 | ||
317 | err = iio_device_register(indio_dev); | 316 | err = iio_device_register(indio_dev); |
318 | if (err) | 317 | if (err) |
@@ -324,9 +323,6 @@ static int adjd_s311_probe(struct i2c_client *client, | |||
324 | 323 | ||
325 | exit_unreg_buffer: | 324 | exit_unreg_buffer: |
326 | iio_triggered_buffer_cleanup(indio_dev); | 325 | iio_triggered_buffer_cleanup(indio_dev); |
327 | exit_free_device: | ||
328 | iio_device_free(indio_dev); | ||
329 | exit: | ||
330 | return err; | 326 | return err; |
331 | } | 327 | } |
332 | 328 | ||
@@ -338,7 +334,6 @@ static int adjd_s311_remove(struct i2c_client *client) | |||
338 | iio_device_unregister(indio_dev); | 334 | iio_device_unregister(indio_dev); |
339 | iio_triggered_buffer_cleanup(indio_dev); | 335 | iio_triggered_buffer_cleanup(indio_dev); |
340 | kfree(data->buffer); | 336 | kfree(data->buffer); |
341 | iio_device_free(indio_dev); | ||
342 | 337 | ||
343 | return 0; | 338 | return 0; |
344 | } | 339 | } |