diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-10-14 14:46:58 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-17 15:34:53 -0700 |
commit | d2fffd6c2fd60fe9ab63ef30758d9d43a5057549 (patch) | |
tree | 7c0178872f67c15707cd3c89f82352ba90da1d09 /drivers/staging/iio/dds | |
parent | cdea0bec8d37f2943ae500512b0c178bc76de6e3 (diff) |
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/dds')
-rw-r--r-- | drivers/staging/iio/dds/ad5930.c | 1 | ||||
-rw-r--r-- | drivers/staging/iio/dds/ad9832.c | 9 | ||||
-rw-r--r-- | drivers/staging/iio/dds/ad9834.c | 8 | ||||
-rw-r--r-- | drivers/staging/iio/dds/ad9850.c | 1 | ||||
-rw-r--r-- | drivers/staging/iio/dds/ad9852.c | 1 | ||||
-rw-r--r-- | drivers/staging/iio/dds/ad9910.c | 1 | ||||
-rw-r--r-- | drivers/staging/iio/dds/ad9951.c | 1 |
7 files changed, 14 insertions, 8 deletions
diff --git a/drivers/staging/iio/dds/ad5930.c b/drivers/staging/iio/dds/ad5930.c index 4847ea2941d4..f5e368b56650 100644 --- a/drivers/staging/iio/dds/ad5930.c +++ b/drivers/staging/iio/dds/ad5930.c @@ -130,6 +130,7 @@ error_ret: static int __devexit ad5930_remove(struct spi_device *spi) { iio_device_unregister(spi_get_drvdata(spi)); + iio_free_device(spi_get_drvdata(spi)); return 0; } diff --git a/drivers/staging/iio/dds/ad9832.c b/drivers/staging/iio/dds/ad9832.c index aefcab1c3fe9..0db0b3a8c855 100644 --- a/drivers/staging/iio/dds/ad9832.c +++ b/drivers/staging/iio/dds/ad9832.c @@ -328,13 +328,14 @@ static int __devexit ad9832_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); struct ad9832_state *st = iio_priv(indio_dev); - struct regulator *reg = st->reg; iio_device_unregister(indio_dev); - if (!IS_ERR(reg)) { - regulator_disable(reg); - regulator_put(reg); + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); } + iio_free_device(indio_dev); + return 0; } diff --git a/drivers/staging/iio/dds/ad9834.c b/drivers/staging/iio/dds/ad9834.c index fe461199801e..c468f696fe25 100644 --- a/drivers/staging/iio/dds/ad9834.c +++ b/drivers/staging/iio/dds/ad9834.c @@ -417,13 +417,13 @@ static int __devexit ad9834_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); struct ad9834_state *st = iio_priv(indio_dev); - struct regulator *reg = st->reg; iio_device_unregister(indio_dev); - if (!IS_ERR(reg)) { - regulator_disable(reg); - regulator_put(reg); + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); } + iio_free_device(indio_dev); return 0; } diff --git a/drivers/staging/iio/dds/ad9850.c b/drivers/staging/iio/dds/ad9850.c index 7f2dd47334f3..a14771b24c50 100644 --- a/drivers/staging/iio/dds/ad9850.c +++ b/drivers/staging/iio/dds/ad9850.c @@ -116,6 +116,7 @@ error_ret: static int __devexit ad9850_remove(struct spi_device *spi) { iio_device_unregister(spi_get_drvdata(spi)); + iio_free_device(spi_get_drvdata(spi)); return 0; } diff --git a/drivers/staging/iio/dds/ad9852.c b/drivers/staging/iio/dds/ad9852.c index 7f65b92598d5..cfceaa64a53a 100644 --- a/drivers/staging/iio/dds/ad9852.c +++ b/drivers/staging/iio/dds/ad9852.c @@ -267,6 +267,7 @@ error_ret: static int __devexit ad9852_remove(struct spi_device *spi) { iio_device_unregister(spi_get_drvdata(spi)); + iio_free_device(spi_get_drvdata(spi)); return 0; } diff --git a/drivers/staging/iio/dds/ad9910.c b/drivers/staging/iio/dds/ad9910.c index b72df8ca7235..da83d2b88c4a 100644 --- a/drivers/staging/iio/dds/ad9910.c +++ b/drivers/staging/iio/dds/ad9910.c @@ -400,6 +400,7 @@ error_ret: static int __devexit ad9910_remove(struct spi_device *spi) { iio_device_unregister(spi_get_drvdata(spi)); + iio_free_device(spi_get_drvdata(spi)); return 0; } diff --git a/drivers/staging/iio/dds/ad9951.c b/drivers/staging/iio/dds/ad9951.c index 3d478e7a48fc..20c182576def 100644 --- a/drivers/staging/iio/dds/ad9951.c +++ b/drivers/staging/iio/dds/ad9951.c @@ -211,6 +211,7 @@ error_ret: static int __devexit ad9951_remove(struct spi_device *spi) { iio_device_unregister(spi_get_drvdata(spi)); + iio_free_device(spi_get_drvdata(spi)); return 0; } |