From patchwork Fri Apr 1 15:08:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: axel lin X-Patchwork-Id: 681781 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 p31F8EwM020029 for ; Fri, 1 Apr 2011 15:08:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639Ab1DAPIN (ORCPT ); Fri, 1 Apr 2011 11:08:13 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:54917 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750936Ab1DAPIN (ORCPT ); Fri, 1 Apr 2011 11:08:13 -0400 Received: by iyb14 with SMTP id 14so3585062iyb.19 for ; Fri, 01 Apr 2011 08:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:to:cc:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; bh=TBMoja2LVHQr9XfOf0KCpwtRDMcOlM4Fr0lxIqCjbmM=; b=Y2kNZZLEIUxdV1vIW/Un9t9PGy++Nr83rDUwN7OIUzZR22+A+/rDWffQnIozaMYAIz ToqpSoKuQ0Pj4ZfxLIWn2F+nX9kmmI/pucczj9ZrzT7MF5AWNMVQY3tZi7B3Rbs49vEg 3hfFMfkBFWs8D5Jhy7ZlRZsGILMX9K8TCDq/Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=VVROYlRL4Vkth/4c4+4AODTXXmGoFFCmc5HW72Q+SUTMJRkFJozgHLMMDam0rxK/m6 6aAdEE+oQJ0e8InjpFsSdXt1Sa6P6Bcz0WakK9GewN1qJ/oO/4sLbDce7EinYCJtei5k Cq2zD8qyHnxK4119kYJdvXDvCXa9aopuxkA7c= Received: by 10.42.29.202 with SMTP id s10mr5171442icc.4.1301670491257; Fri, 01 Apr 2011 08:08:11 -0700 (PDT) Received: from [218.167.78.181] (218-167-78-181.dynamic.hinet.net [218.167.78.181]) by mx.google.com with ESMTPS id u9sm1518738ibe.36.2011.04.01.08.08.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Apr 2011 08:08:10 -0700 (PDT) Subject: [PATCH] Input: twl4030_keypad - fix potential NULL dereference in twl4030_kp_probe() From: Axel Lin To: linux-kernel@vger.kernel.org Cc: David Brownell , Dmitry Torokhov , linux-input@vger.kernel.org Date: Fri, 01 Apr 2011 23:08:03 +0800 Message-ID: <1301670483.6013.4.camel@phoenix> 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]); Fri, 01 Apr 2011 15:08:14 +0000 (UTC) diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index 09bef79..d02811c 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -332,7 +332,7 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp) static int __devinit twl4030_kp_probe(struct platform_device *pdev) { struct twl4030_keypad_data *pdata = pdev->dev.platform_data; - const struct matrix_keymap_data *keymap_data = pdata->keymap_data; + const struct matrix_keymap_data *keymap_data; struct twl4030_keypad *kp; struct input_dev *input; u8 reg; @@ -344,6 +344,8 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev) return -EINVAL; } + keymap_data = pdata->keymap_data; + kp = kzalloc(sizeof(*kp), GFP_KERNEL); input = input_allocate_device(); if (!kp || !input) {