From patchwork Wed Oct 27 10:08:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 285312 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 o9RA8aRA022665 for ; Wed, 27 Oct 2010 10:08:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758207Ab0J0KIf (ORCPT ); Wed, 27 Oct 2010 06:08:35 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:55037 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754463Ab0J0KIe (ORCPT ); Wed, 27 Oct 2010 06:08:34 -0400 Received: by wyf28 with SMTP id 28so505160wyf.19 for ; Wed, 27 Oct 2010 03:08:33 -0700 (PDT) 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=9yXwMYhh0n8z84UoR6QgxTl4dIe+UZiAViMgAyuYZ4c=; b=OP+rRjvK9pgb/3K0FWbXacamlOvV48XRUj+Id3DfW9P/HZDH9KFw6iXyF25y7aYJ5b A1j+N0R3pved5DusCcLuxhfa3hqKkUKrRf01JZ7Aqja8coNXUcANHp50d/tzIlpdg2G6 ovKGm3bOauf9QzZnXQxXM0lUNH0wvpAcFe58k= 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=lJz/A44y2wPmkaAwNUFsTo1sE9RA4x7h/+09cS4895dTAQHWN9D/zqLvJAu+8jv8yg 9d8H8h1o5Qpk3dbcvvf6+lkXgwdRHaEffZWFm8l0r3/J5SUJl5qVtgCM5Noo7UZLCzmE +FRRvcpgY3cGqILWW93IEZElSL6S2wQwhot5g= Received: by 10.216.35.133 with SMTP id u5mr8784540wea.72.1288174113032; Wed, 27 Oct 2010 03:08:33 -0700 (PDT) Received: from bicker (h3f04.n1.ips.mtn.co.ug [41.210.191.4]) by mx.google.com with ESMTPS id y80sm5769623weq.27.2010.10.27.03.08.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 27 Oct 2010 03:08:31 -0700 (PDT) Date: Wed, 27 Oct 2010 12:08:22 +0200 From: Dan Carpenter To: Dmitry Torokhov Cc: Henrik Rydberg , Naveen Kumar Gaddipati , Linus Walleij , linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] touchscreen/bu21013_ts: null dereference in error handling Message-ID: <20101027100822.GF6062@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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]); Wed, 27 Oct 2010 10:08:37 +0000 (UTC) diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index ccde586..8f120b1 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -446,11 +446,14 @@ static int __devinit bu21013_probe(struct i2c_client *client, } bu21013_data = kzalloc(sizeof(struct bu21013_ts_data), GFP_KERNEL); + if (!bu21013_data) + return -ENOMEM; + in_dev = input_allocate_device(); - if (!bu21013_data || !in_dev) { + if (!in_dev) { dev_err(&client->dev, "device memory alloc failed\n"); error = -ENOMEM; - goto err_free_mem; + goto err_free; } bu21013_data->in_dev = in_dev; @@ -515,6 +518,7 @@ err_cs_disable: pdata->cs_dis(pdata->cs_pin); err_free_mem: input_free_device(bu21013_data->in_dev); +err_free: kfree(bu21013_data); return error;