From a1cd3fd09a9b7de710d705127aa616946b567d72 Mon Sep 17 00:00:00 2001 From: Pramod Gurav Date: Wed, 30 Jul 2014 22:48:24 -0700 Subject: Input: ads7846 - release resources on failure for clean exit Input device must be released(input_free_device) when ads7846_probe_dt fails. This fixes the same by releasing resources on failure. Signed-off-by: Pramod Gurav Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/ads7846.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/input/touchscreen/ads7846.c') diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index da201b8e37dc..e57ba52bf484 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -1302,8 +1302,10 @@ static int ads7846_probe(struct spi_device *spi) pdata = dev_get_platdata(&spi->dev); if (!pdata) { pdata = ads7846_probe_dt(&spi->dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); + if (IS_ERR(pdata)) { + err = PTR_ERR(pdata); + goto err_free_mem; + } } ts->model = pdata->model ? : 7846; -- cgit