Explorar o código

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 <pramod.gurav@smartplayin.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Pramod Gurav %!s(int64=11) %!d(string=hai) anos
pai
achega
a1cd3fd09a
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      drivers/input/touchscreen/ads7846.c

+ 4 - 2
drivers/input/touchscreen/ads7846.c

@@ -1302,8 +1302,10 @@ static int ads7846_probe(struct spi_device *spi)
 	pdata = dev_get_platdata(&spi->dev);
 	pdata = dev_get_platdata(&spi->dev);
 	if (!pdata) {
 	if (!pdata) {
 		pdata = ads7846_probe_dt(&spi->dev);
 		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;
 	ts->model = pdata->model ? : 7846;