From patchwork Thu Nov 11 07:28:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 316502 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 oAB7Swsa029716 for ; Thu, 11 Nov 2010 07:28:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788Ab0KKH24 (ORCPT ); Thu, 11 Nov 2010 02:28:56 -0500 Received: from mail-ww0-f42.google.com ([74.125.82.42]:60252 "EHLO mail-ww0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996Ab0KKH24 (ORCPT ); Thu, 11 Nov 2010 02:28:56 -0500 Received: by wwb39 with SMTP id 39so256889wwb.1 for ; Wed, 10 Nov 2010 23:28:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=iR6nOLauXQeDd5hMFfk96PO3gfIwDVZ7qfpI5dmLi88=; b=LQxD+4ocfluLATipUu+QtMNswUW4cf6EqdeTzoxRU1UM7RkO2JloV5lxDSpSrlHcDO TUDfv4cVjJR1dOfxe65cwPTZ7bu3/IT47Mo+qwbKyK9rpb1/TNdNI8c+r5/+zI8YbN/+ L43RbaAVLafppzRzQYw3qfIEuxQ2JixgwfXFY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=X3tAqGv2gsieFGOFqk8V/DpqbVQ/iht1oZByMSnVEJa42/CwbHRHz68DqHlR1nMhqi AASV2OCwiQ4faut4uhOZGGWMPAhBPKfxh0Bwq4IOOztkEzq5/pecGkADF7JlH1IFcBdx hCfBOrZQPJSOa94ytjGtVMBcK+ZtEH98kMDOs= Received: by 10.227.129.7 with SMTP id m7mr399868wbs.120.1289460533465; Wed, 10 Nov 2010 23:28:53 -0800 (PST) Received: from bicker (h2d33.n1.ips.mtn.co.ug [41.210.173.51]) by mx.google.com with ESMTPS id e12sm1049508wer.12.2010.11.10.23.28.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Nov 2010 23:28:49 -0800 (PST) Date: Thu, 11 Nov 2010 10:28:30 +0300 From: Dan Carpenter To: Dmitry Torokhov Cc: Jean Delvare , Mike Frysinger , Richard Purdie , linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] input: pcf8574_keypad: use after input_unregister_device() Message-ID: <20101111062429.GA3610@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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.3 (demeter1.kernel.org [140.211.167.41]); Thu, 11 Nov 2010 07:28:58 +0000 (UTC) diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c index 4b42ffc..d0b0e36 100644 --- a/drivers/input/misc/pcf8574_keypad.c +++ b/drivers/input/misc/pcf8574_keypad.c @@ -129,12 +129,6 @@ static int __devinit pcf8574_kp_probe(struct i2c_client *client, const struct i2 input_set_drvdata(idev, lp); - ret = input_register_device(idev); - if (ret) { - dev_err(&client->dev, "input_register_device() failed\n"); - goto fail_register; - } - lp->laststate = read_state(lp); ret = request_threaded_irq(client->irq, NULL, pcf8574_kp_irq_handler, @@ -142,16 +136,22 @@ static int __devinit pcf8574_kp_probe(struct i2c_client *client, const struct i2 DRV_NAME, lp); if (ret) { dev_err(&client->dev, "IRQ %d is not free\n", client->irq); - goto fail_irq; + goto fail_free_device; } i2c_set_clientdata(client, lp); + + ret = input_register_device(idev); + if (ret) { + dev_err(&client->dev, "input_register_device() failed\n"); + goto fail_free_irq; + } + return 0; - fail_irq: - input_unregister_device(idev); - fail_register: - input_set_drvdata(idev, NULL); + fail_free_irq: + free_irq(client->irq, lp); + fail_free_device: input_free_device(idev); fail_allocate: kfree(lp);