From patchwork Wed Jul 30 05:54:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pramod.gurav.etc@gmail.com X-Patchwork-Id: 4645971 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C53D9F36A for ; Wed, 30 Jul 2014 05:51:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6A942012D for ; Wed, 30 Jul 2014 05:51:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B173820123 for ; Wed, 30 Jul 2014 05:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751320AbaG3Fvc (ORCPT ); Wed, 30 Jul 2014 01:51:32 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:60293 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbaG3Fvb (ORCPT ); Wed, 30 Jul 2014 01:51:31 -0400 Received: by mail-pa0-f54.google.com with SMTP id fa1so914200pad.27 for ; Tue, 29 Jul 2014 22:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=tS4MgYKHv8QNIRYujLyYTAyae8yGUbHYPZP1RO3hFDs=; b=FIyGyNWwXv3I14cfTy3L2yNHVT+mHbXTPtypT6LkVCx7VLnPZbD2FBKeKbdoj9+5HU 7M8Bcr0PAXC6aUoE0+6Cpq0kO8qgy3RrRbBkl6QLRWwNLJmrTGPq1/oF7P3dVLmyROOL 80HTsT/UvQK43gXQ6n4jE/fSbL7C/fVdtuVRZMxZE4UHd+ZmlsUnjPFmx2dhAZx+mxYz cmwsoE0ctX3jslDrvRWbu/3x3tswAvCX772BDnSLsJ5d3+vv15/ExALGmUtpoBwPQR4f umNZiqN7nIGP3WjoN0znUNwIKshCEoS1T3POKvFdytqmb2dZXuR80SDTc+u0RL3EgJ8g SzdQ== X-Received: by 10.70.134.39 with SMTP id ph7mr2092356pdb.32.1406699490981; Tue, 29 Jul 2014 22:51:30 -0700 (PDT) Received: from SPINITLTDL00278.smartplayin.local ([220.227.185.53]) by mx.google.com with ESMTPSA id qn7sm4170304pac.42.2014.07.29.22.51.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Jul 2014 22:51:29 -0700 (PDT) From: Pramod Gurav To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pramod Gurav , Dmitry Torokhov , Lejun Zhu , Sachin Kamat Subject: [PATCH] input: ads7846: Release resources on failure for clean exit Date: Wed, 30 Jul 2014 11:24:37 +0530 Message-Id: <1406699677-1347-1-git-send-email-pramod.gurav.etc@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pramod Gurav Input device must be released(input_free_device) when ads7846_probe_dt fails. This fixes the same by releasing resources on failure. CC: Dmitry Torokhov CC: Lejun Zhu CC: Sachin Kamat Signed-off-by: Pramod Gurav --- drivers/input/touchscreen/ads7846.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index da201b8..e57ba52 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;