summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/adc/ad7816.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-10-14 17:46:58 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-18 02:34:53 +0400
commitd2fffd6c2fd60fe9ab63ef30758d9d43a5057549 (patch)
tree7c0178872f67c15707cd3c89f82352ba90da1d09 /drivers/staging/iio/adc/ad7816.c
parentcdea0bec8d37f2943ae500512b0c178bc76de6e3 (diff)
downloadlinux-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/adc/ad7816.c')
-rw-r--r--drivers/staging/iio/adc/ad7816.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 1440619d74e0..bdb90492b8a5 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -435,13 +435,14 @@ static int __devexit ad7816_remove(struct spi_device *spi_dev)
struct iio_dev *indio_dev = dev_get_drvdata(&spi_dev->dev);
struct ad7816_chip_info *chip = iio_priv(indio_dev);
+ iio_device_unregister(indio_dev);
dev_set_drvdata(&spi_dev->dev, NULL);
if (spi_dev->irq)
free_irq(spi_dev->irq, indio_dev);
gpio_free(chip->busy_pin);
gpio_free(chip->convert_pin);
gpio_free(chip->rdwr_pin);
- iio_device_unregister(indio_dev);
+ iio_free_device(indio_dev);
return 0;
}