From patchwork Thu Aug 11 08:49:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: axel lin X-Patchwork-Id: 1056112 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7B8m7fh010099 for ; Thu, 11 Aug 2011 08:49:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753641Ab1HKItx (ORCPT ); Thu, 11 Aug 2011 04:49:53 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:63009 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753279Ab1HKItw (ORCPT ); Thu, 11 Aug 2011 04:49:52 -0400 Received: by gya6 with SMTP id 6so1171215gya.19 for ; Thu, 11 Aug 2011 01:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=nJa1UtsfiMj/RWtZFcRN/6KokSB256b8eWtHJgSXRrk=; b=x+/K86lGSXkS0mvntBJNx2iiubG7NrFyFnpDHGxwhZamvofaXeepW3RP1MhOOPOr2u weX6XhNKuIe8b52YzVze3Z4ZqyeVFRe/g5un6JdbW2O1H2oBtLlpJ+zI8Dph2H2xvZRO AZ/6LYhTchUpDYWLLxrPIfP9iay5Osve5TIaE= Received: by 10.150.159.16 with SMTP id h16mr368531ybe.196.1313052591646; Thu, 11 Aug 2011 01:49:51 -0700 (PDT) Received: from [218.172.236.176] (218-172-236-176.dynamic.hinet.net [218.172.236.176]) by mx.google.com with ESMTPS id c11sm1062281ybj.10.2011.08.11.01.49.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Aug 2011 01:49:51 -0700 (PDT) Subject: [PATCH RESEND] Input: tegra-kbc - correct call to input_free_device From: Axel Lin To: linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Rakesh Iyer , linux-input@vger.kernel.org Date: Thu, 11 Aug 2011 16:49:29 +0800 Message-ID: <1313052569.2139.1.camel@phoenix> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 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]); Thu, 11 Aug 2011 08:49:53 +0000 (UTC) If kzalloc for kbc fails, then we have NULL pointer dereference while calling input_free_device(kbc->idev) in the error handling. So it is safer to always use the original name, input_dev. Signed-off-by: Axel Lin --- drivers/input/keyboard/tegra-kbc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index 2b3b73e..8e40f2b 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c @@ -701,7 +701,7 @@ err_iounmap: err_free_mem_region: release_mem_region(res->start, resource_size(res)); err_free_mem: - input_free_device(kbc->idev); + input_free_device(input_dev); kfree(kbc); return err;