Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ti-adc128s052: Use devm_mutex_init()

Quoting Jonathan:
"Whilst it doesn't bring huge advantage, now we have devm_mutex_init()
it seems reasonable to use it and maybe catch a use after free for the
lock"

Switch to use devm_mutex_init() while working on this file.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/efe4a039e2bfbf4dcf30743f6b7b88fce3b9ee39.1744022065.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Matti Vaittinen and committed by
Jonathan Cameron
804757a2 6c41d590

+3 -1
+3 -1
drivers/iio/adc/ti-adc128s052.c
··· 172 172 if (ret) 173 173 return ret; 174 174 175 - mutex_init(&adc->lock); 175 + ret = devm_mutex_init(&spi->dev, &adc->lock); 176 + if (ret) 177 + return ret; 176 178 177 179 return devm_iio_device_register(&spi->dev, indio_dev); 178 180 }