diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-07-22 12:03:00 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 18:41:08 +0100 |
commit | e434dcf3912d27a0c339db7b793a4b21613431c1 (patch) | |
tree | 5b10b8bab1b79137de53b55dc647623d9f5dd55e | |
parent | 8c7f6d562ed697ef559a535288e9ed1e730512bc (diff) |
staging: iio: light: isl29018: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/staging/iio/light/isl29018.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 82478a59e42e..351936c3efd6 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -550,11 +550,10 @@ static int isl29018_probe(struct i2c_client *client, struct iio_dev *indio_dev; int err; - indio_dev = iio_device_alloc(sizeof(*chip)); + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); if (indio_dev == NULL) { dev_err(&client->dev, "iio allocation fails\n"); - err = -ENOMEM; - goto exit; + return -ENOMEM; } chip = iio_priv(indio_dev); @@ -572,12 +571,12 @@ static int isl29018_probe(struct i2c_client *client, if (IS_ERR(chip->regmap)) { err = PTR_ERR(chip->regmap); dev_err(chip->dev, "regmap initialization failed: %d\n", err); - goto exit; + return err; } err = isl29018_chip_init(chip); if (err) - goto exit_iio_free; + return err; indio_dev->info = &isl29108_info; indio_dev->channels = isl29018_channels; @@ -588,14 +587,10 @@ static int isl29018_probe(struct i2c_client *client, err = iio_device_register(indio_dev); if (err) { dev_err(&client->dev, "iio registration fails\n"); - goto exit_iio_free; + return err; } return 0; -exit_iio_free: - iio_device_free(indio_dev); -exit: - return err; } static int isl29018_remove(struct i2c_client *client) @@ -604,7 +599,6 @@ static int isl29018_remove(struct i2c_client *client) dev_dbg(&client->dev, "%s()\n", __func__); iio_device_unregister(indio_dev); - iio_device_free(indio_dev); return 0; } |