staging:iio:ad2s1210 fix a leak when device removed
Subsystems (4)
PATCH 1/1 staging:iio:ad2s1210 fix a leak when device removed
--- drivers/staging/iio/resolver/ad2s1210.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/iio/resolver/ad2s1210.c +1 -0
@@ -716,6 +716,7 @@ static int ad2s1210_remove(struct spi_device *spi)iio_device_unregister (indio_dev);ad2s1210_free_gpios (iio_priv (indio_dev)); +devm_iio_device_free (&spi->dev, indio_dev);return 0 ; }
Signature · 1 line
1.7.9.5
Jingoo Han
NAKQuoted 11 lines · Jimmy Li
Signed-off-by Jimmy Li <[email protected]>--- drivers/staging/iio/resolver/ad2s1210.c | 1 + 1 file changed, 1 insertion(+)drivers/staging/iio/resolver/ad2s1210.c +0
-0
drivers/staging/iio/resolver/ad2s1210.c static int ad2s1210_remove(struct spi_device *spi) · line 719
Quoted 4 lines
drivers/staging/iio/resolver/ad2s1210.c +1
-0@@ -716,6 +716,7 @@ static int ad2s1210_remove(struct spi_device *spi)iio_device_unregister (indio_dev);ad2s1210_free_gpios (iio_priv (indio_dev)); +devm_iio_device_free (&spi->dev, indio_dev);
NAK.
In ad2s1210_probe(),devm_iio_device_alloc() was already used. So, when ad2s1210_remove() is called, iio_device_free() will be called automatically. So, the leak never happens.
If you want to know about devm_* functions, please refer to the following.
Documentation/driver-model/devres.txt
Best regards,
Jingoo Han
Quoted 5 lines
drivers/staging/iio/resolver/ad2s1210.c +0
-1return 0 ; } --1.7.9.5
Quoted 19 lines · Jingoo Han
Quoted 11 lines · Jimmy Li
Signed-off-by Jimmy Li <[email protected]>--- drivers/staging/iio/resolver/ad2s1210.c | 1 + 1 file changed, 1 insertion(+)drivers/staging/iio/resolver/ad2s1210.c +0
-0drivers/staging/iio/resolver/ad2s1210.c static int ad2s1210_remove(struct spi_device *spi) · line 719
Quoted 4 lines
drivers/staging/iio/resolver/ad2s1210.c +1
-0@@ -716,6 +716,7 @@ static int ad2s1210_remove(struct spi_device *spi)iio_device_unregister (indio_dev);ad2s1210_free_gpios (iio_priv (indio_dev)); +devm_iio_device_free (&spi->dev, indio_dev);NAK.
Quoted 8 lines
In ad2s1210_probe(),devm_iio_device_alloc() was already used. So, when
ad2s1210_remove()is called,iio_device_free()will be called automatically. So, the leak never happens.If you want to know about devm_* functions, please refer to the following.
Documentation/driver-model/devres.txt
Thank you for your reply,
I understand it now, just ignore this patch.
Quoted 9 lines
Best regards,
Jingoo HanQuoted 5 lines
drivers/staging/iio/resolver/ad2s1210.c +0
-1return 0 ; } --1.7.9.5