From patchwork Wed Jul 3 17:14:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 2818311 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 1CA739F968 for ; Wed, 3 Jul 2013 17:15:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 030E1201DE for ; Wed, 3 Jul 2013 17:15:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02F72201D7 for ; Wed, 3 Jul 2013 17:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964848Ab3GCRPV (ORCPT ); Wed, 3 Jul 2013 13:15:21 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:61103 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964815Ab3GCRPU (ORCPT ); Wed, 3 Jul 2013 13:15:20 -0400 Received: by mail-pa0-f46.google.com with SMTP id fa11so442987pad.5 for ; Wed, 03 Jul 2013 10:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=pliywJPtkpx0YyI4lOiSASXH9in6os+yASAoaQrPl9E=; b=gDLWaK+lgJdZU7j8Bv0oRdXhYpQ5CgbPQjJBxY0RknoxGMni5i5NW9ghevrbhiX7UH Jz4MxWOtkvfHKdFRR+kXQCUR8Hi6YK+QG53Oyd3u7yzVNTb+y6k2zgFbB9npk5l9Rkkd 6JoVma3w5Fzlw56TOFiGityGH4NUz4a7jj7jAkgRHWPAR9VuT1NQfVQOkj2YMNc2avQb p772grGVuQVLldyfILgvMv3DLAhOI0fBKVGlI1PkrJhyU0eMxZeRuf0urNk/W1xf0u5e rNGtxLbcopA265F+c9CjmgVTJH4rVJ0sTHKcH4xqOvaG+oSUyrNfcaulxq5zWNp3xq6y IIUg== X-Received: by 10.66.83.7 with SMTP id m7mr3355185pay.150.1372871718685; Wed, 03 Jul 2013 10:15:18 -0700 (PDT) Received: from localhost.localdomain ([78.189.35.227]) by mx.google.com with ESMTPSA id br1sm32319150pbb.4.2013.07.03.10.15.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Jul 2013 10:15:17 -0700 (PDT) From: Ferruh Yigit To: Dan Carpenter Cc: Dmitry Torokhov , ttdrivers@cypress.com, Javier Martinez Canillas , linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org, Ferruh Yigit Subject: [PATCH] Input: cyttsp4 - kfree xfer_buf on error path in probe() Date: Wed, 3 Jul 2013 20:14:52 +0300 Message-Id: <1372871693-9871-1-git-send-email-fery@cypress.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <51D42CD3.2000705@cypress.com> References: <51D42CD3.2000705@cypress.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 If probe() fails after cd->xfer_buf allocated, it will not freed. Added kfree(cd->xfer_buf) with and error label. Signed-off-by: Ferruh Yigit --- drivers/input/touchscreen/cyttsp4_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index a7987e1..edcf799 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -2049,7 +2049,7 @@ struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops, cd->irq = gpio_to_irq(cd->cpdata->irq_gpio); if (cd->irq < 0) { rc = -EINVAL; - goto error_free_cd; + goto error_free_xfer; } dev_set_drvdata(dev, cd); @@ -2117,6 +2117,8 @@ error_request_irq: if (cd->cpdata->init) cd->cpdata->init(cd->cpdata, 0, dev); dev_set_drvdata(dev, NULL); +error_free_xfer: + kfree(cd->xfer_buf); error_free_cd: kfree(cd); error_alloc_data: