From patchwork Mon Apr 4 22:57:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Fritz X-Patchwork-Id: 685701 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p34MvKTi002438 for ; Mon, 4 Apr 2011 22:57:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755778Ab1DDW5T (ORCPT ); Mon, 4 Apr 2011 18:57:19 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:55030 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753920Ab1DDW5T (ORCPT ); Mon, 4 Apr 2011 18:57:19 -0400 Received: by wya21 with SMTP id 21so5099084wya.19 for ; Mon, 04 Apr 2011 15:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:subject:from:to:cc:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; bh=PYxFb1taFvPKGevDSWkxqGb4vrZj4Pa4R6R3JUrEgyo=; b=IeUf8DxMJgrWdjjLiCyQxiA/EfZtIus8gTveNrFBLA7tYZbL6G5SzrtsMdgLxEo8Kk sfriGs1JlSHxmm9llysVj/qmsoHOL9gvN0bchtQKwS9va3hPKw2V/02o0cPdC+EVdMAf uf6wU8Rmf83kSV+nMo6/Eh8evdxDCmzJXnNFQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=nYrT1ZpgNBcaQQWltQYOvRlgJME8khMyQtfBhtGKlKYknvJLNq6i7pEjGFB986NPla JiuHemquO/b1UYsPCJEWoD5YDTnKzs3MuNN8vwognVfY2wNt3ZjJOZObUU9x0X6aAdMm QBvARq37L5u+nAHT789I43QS7Gv85/fQr1HU8= Received: by 10.227.9.131 with SMTP id l3mr3820741wbl.54.1301957837336; Mon, 04 Apr 2011 15:57:17 -0700 (PDT) Received: from [192.168.1.25] (pD9FCAEDE.dip.t-dialin.net [217.252.174.222]) by mx.google.com with ESMTPS id b20sm3190272wbb.16.2011.04.04.15.57.15 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 04 Apr 2011 15:57:15 -0700 (PDT) Subject: [PATCH] Input: h3600_ts - fix error handling at connect From: Christoph Fritz To: Dmitry Torokhov Cc: linux-input , jsimmons@transvirtual.com Date: Tue, 05 Apr 2011 00:57:12 +0200 Message-ID: <1301957832.3352.8.camel@lovely> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 04 Apr 2011 22:57:21 +0000 (UTC) In case of an error in h3600ts_connect(), deconstruct by correct order and with the right calls. Signed-off-by: Christoph Fritz --- drivers/input/touchscreen/h3600_ts_input.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index b4d7f63..6ae063e 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c @@ -399,31 +399,34 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); err = -EBUSY; - goto fail2; + goto fail1; } if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); err = -EBUSY; - goto fail3; + goto fail2; } serio_set_drvdata(serio, ts); err = serio_open(serio, drv); if (err) - return err; + goto fail3; //h3600_flite_control(1, 25); /* default brightness */ - input_register_device(ts->dev); + err = input_register_device(ts->dev); + if (err) + goto fail4; return 0; -fail3: free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); +fail4: serio_close(serio); +fail3: serio_set_drvdata(serio, NULL); + free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); -fail1: serio_set_drvdata(serio, NULL); - input_free_device(input_dev); +fail1: input_free_device(input_dev); kfree(ts); return err; }