summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/meter/ade7758_core.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-10-14 13:46:58 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-17 22:34:53 (GMT)
commitd2fffd6c2fd60fe9ab63ef30758d9d43a5057549 (patch)
tree7c0178872f67c15707cd3c89f82352ba90da1d09 /drivers/staging/iio/meter/ade7758_core.c
parentcdea0bec8d37f2943ae500512b0c178bc76de6e3 (diff)
downloadlinux-fsl-qoriq-d2fffd6c2fd60fe9ab63ef30758d9d43a5057549.tar.xz
staging:iio: fix removal path to allow correct freeing.
Fix a dumb lack of consideration of the effect of combining the iio_device_unregister and iio_free_device calls into one. There is no valid place to free some of the sysfs array elements. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/meter/ade7758_core.c')
-rw-r--r--drivers/staging/iio/meter/ade7758_core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 6ea5c74..c5dafbd 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -822,6 +822,7 @@ static int ade7758_remove(struct spi_device *spi)
struct ade7758_state *st = iio_priv(indio_dev);
int ret;
+ iio_device_unregister(indio_dev);
ret = ade7758_stop_device(&indio_dev->dev);
if (ret)
goto err_ret;
@@ -831,9 +832,9 @@ static int ade7758_remove(struct spi_device *spi)
ade7758_unconfigure_ring(indio_dev);
kfree(st->tx);
kfree(st->rx);
- iio_device_unregister(indio_dev);
- return 0;
+ iio_free_device(indio_dev);
+
err_ret:
return ret;
}