diff mbox

[-next] Input: fix error return code in atmel_tsadcc_probe()

Message ID CAPgLHd_WUdJe+4mEDxXOoqZzGyQBb49wO=OQ+kz_3_nNLV26xA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun May 28, 2013, 5:19 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

If pdata is NULL, atmel_tsadcc_probe() will release all the resources
and return 0, but we need a error code is returned in this case.
Fix to return -EINVAL and move the check for pdata to the begin
of this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
 drivers/input/touchscreen/atmel_tsadcc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox


diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c
index 75a0693..fbc72dd 100644
--- a/drivers/input/touchscreen/atmel_tsadcc.c
+++ b/drivers/input/touchscreen/atmel_tsadcc.c
@@ -187,6 +187,9 @@  static int atmel_tsadcc_probe(struct platform_device *pdev)
 	unsigned int	prsc;
 	unsigned int	reg;
+	if (!pdata)
+		return -EINVAL;
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
 		dev_err(&pdev->dev, "no mmio resource defined.\n");
@@ -265,9 +268,6 @@  static int atmel_tsadcc_probe(struct platform_device *pdev)
 	prsc = clk_get_rate(ts_dev->clk);
 	dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc);
-	if (!pdata)
-		goto err_fail;
 	if (!pdata->adc_clock)
 		pdata->adc_clock = ADC_DEFAULT_CLOCK;