From patchwork Tue May 28 05:19:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2622911 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A7565DFB78 for ; Tue, 28 May 2013 05:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932464Ab3E1FT7 (ORCPT ); Tue, 28 May 2013 01:19:59 -0400 Received: from mail-bk0-f50.google.com ([209.85.214.50]:48551 "EHLO mail-bk0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932458Ab3E1FT7 (ORCPT ); Tue, 28 May 2013 01:19:59 -0400 Received: by mail-bk0-f50.google.com with SMTP id ik8so2955771bkc.23 for ; Mon, 27 May 2013 22:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=SnzlH0l2ux111vhAKeWmo51aa+vr/JzoMLRXDN5iAEg=; b=lTGLe5Ll89P7MjkG6+mcnqiPYTXPx3JGW5Vw6hynHbxfwDEGCpwGvCLKQCvsuBtSJi xL0z+XQzj7a38YlTK6woyvL1vLIZXTJ5cVBgoU3OLp9ctfs79K71/vqnScjl28tOHjq7 cWaUpi7dCiokxN5a7iOWExdzY0bbgKm1bNpMWZ5fpaVeO9JpzvonrLxPnbR9kKbLMCJ4 vqCCiFOWqIQIIwFxRGkS+GSpFreur/MPVu+xajydLxQdzMjFkvSgePR88tS2xsgn1n0d 7novztLoljNLkj31AWefU4TenLxV420yNraQfuIbXWjt3GLLrsPOAavYqwqhFUwCbDwK LgKA== MIME-Version: 1.0 X-Received: by 10.204.240.139 with SMTP id la11mr108568bkb.56.1369718397869; Mon, 27 May 2013 22:19:57 -0700 (PDT) Received: by 10.204.39.1 with HTTP; Mon, 27 May 2013 22:19:57 -0700 (PDT) Date: Tue, 28 May 2013 13:19:57 +0800 Message-ID: Subject: [PATCH -next] Input: fix error return code in atmel_tsadcc_probe() From: Wei Yongjun To: josh.wu@atmel.com, dmitry.torokhov@gmail.com Cc: yongjun_wei@trendmicro.com.cn, linux-input@vger.kernel.org Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Wei Yongjun 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 --- 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 --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;