Re: [PATCH v3 3/3] Input: ads7846: Switch to devm initialization
From: Daniel Mack <daniel@zonque.org>
Date: 2020-05-19 09:29:52
From: Daniel Mack <daniel@zonque.org>
Date: 2020-05-19 09:29:52
Hi Marco! On 5/19/20 11:18 AM, Marco Felsch wrote:
On 20-05-07 08:20, Daniel Mack wrote:quoted
This simplies the code a lot and fixes some potential resource leaks in the error return paths. Signed-off-by: Daniel Mack <daniel@zonque.org> --- drivers/input/touchscreen/ads7846.c | 123 ++++++++++------------------ 1 file changed, 45 insertions(+), 78 deletions(-)
quoted
@@ -1482,26 +1468,7 @@ static int ads7846_remove(struct spi_device *spi) struct ads7846 *ts = spi_get_drvdata(spi); sysfs_remove_group(&spi->dev.kobj, &ads784x_attr_group); - ads7846_disable(ts);Did you tested the bind/unbind path? I think we are getting troubles here because ads7846_disable calls ads7846_stop() and regulator_disable(). Since we are using the devm_action the regualtor gets disabled by this action and ads7846_disable(). This causes a refcount problem.
Ah, nice catch. Yes, we just need to call ads7846_stop() here. Will post a v4 then. Thanks, Daniel