Ensure the mutex will be destroyed on drive removal. Also adds mutex comment description. Signed-off-by: Tallys Martins <tallysmartins@xxxxxxxxx> Signed-off-by: Souza Guilherme <gdsdsilva@xxxxxxxxxxxxxxxx> Co-developed-by: Souza Guilherme <gdsdsilva@xxxxxxxxxxxxxxxx> --- drivers/staging/iio/resolver/ad2s1210.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index b6be0bc202f5..b91cf57c5e57 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -86,7 +86,7 @@ static const struct ad2s1210_gpio gpios[] = { static const unsigned int ad2s1210_resolution_value[] = { 10, 12, 14, 16 }; struct ad2s1210_state { - struct mutex lock; + struct mutex lock; /* lock to protect the state on r/w operations */ struct spi_device *sdev; struct gpio_desc *gpios[5]; unsigned int fclkin; @@ -689,8 +689,10 @@ static int ad2s1210_probe(struct spi_device *spi) static int ad2s1210_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ad2s1210_state *ad2s1210_ad = iio_priv(indio_dev); iio_device_unregister(indio_dev); + mutex_destroy(&ad2s1210_ad->lock); return 0; } -- 2.21.0 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel