Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3960252imj; Tue, 12 Feb 2019 07:32:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IaKyjKuRVFE7b1oNV1Nf8FU6Mn9quEIEAmxZYanf+KOVyx261gfrLnvtl/MbJAtehnjJivR X-Received: by 2002:a63:d347:: with SMTP id u7mr4094861pgi.383.1549985566657; Tue, 12 Feb 2019 07:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549985566; cv=none; d=google.com; s=arc-20160816; b=N4f5PhWnrocXUZsu8qvNWoFKIccx6FupbNyrF2O4h+LgWWDfJKUNhdpaMfMGSmhg/D np4EwMV+5quSR2xqj6o+BG/2dLP3aDgufp2j4tIFBlk7JD3+x8/jo5/Ns0rGQKkOFh6i kIHbVcyVaHnHSViQQXDy97ZRKK9fdlhn1pFSU5uddOepnh3LgvrE9j2UFJHbiRxkF9JP OJJ7JLHAvSr45uaCe3ILA5UlSIObxRfA15BO1QheeZR91gT3Fh38G+Ggd/wTdkcoKQBK yw17KNj/p30bD/G2vjYJyfYkVywA2fQDPqjFMvLj1/lcrscx6Galmfvax0/1fTtuuois 8iyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=zKyjvRPirs0hXlT0btyxg7ZrF26O9Dtch0J1YCjWh3U=; b=xugUCOTiWh/vQE2cg8p52qev96iB/vaj6JgDa6VWWvedvtN/9iSbBryyIW23X9mp3I 5mcGif3GJNLkqLFeVEe9g+vtgEveBfaIqCEgCnNYTAliPh32eCwte3HEpIgjlu442NKh Eov8Xjh9lTFYV0cibPNRv9WKh0bQlnj1F7pJpDGcuLtGm+TMmzhjeCJUiHywbqVd/Ch/ DTzmGHBOfo2APrXx1QnpOHGU3/9FWRw3due0Cgv3Wf6CGGoRRNzxQLuIG70KKOQe0iyX +BxFyHr20AR3mi/+K0IUeVLzAI8BtqVBLJVXnZ2ZGVztPTpW7zu+W/OZ8uGCsm4IyavJ hb0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a143si13727334pfd.24.2019.02.12.07.32.28; Tue, 12 Feb 2019 07:32:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730437AbfBLPbk (ORCPT + 99 others); Tue, 12 Feb 2019 10:31:40 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:16960 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728347AbfBLPbj (ORCPT ); Tue, 12 Feb 2019 10:31:39 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1CFH0Yu019267; Tue, 12 Feb 2019 16:31:27 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2qhurj1344-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 12 Feb 2019 16:31:27 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 825FF3A; Tue, 12 Feb 2019 15:31:26 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag4node2.st.com [10.75.127.11]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 611305494; Tue, 12 Feb 2019 15:31:26 +0000 (GMT) Received: from localhost (10.75.127.45) by SFHDAG4NODE2.st.com (10.75.127.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 12 Feb 2019 16:31:25 +0100 From: To: Dmitry Torokhov , Gabriel Fernandez CC: , , , , , , Nate Drude , Dan Carpenter Subject: [PATCH v1] Input: st-keyscan - fix potential zalloc NULL dereference Date: Tue, 12 Feb 2019 16:30:55 +0100 Message-ID: <20190212153055.3925-1-gabriel.fernandez@st.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG3NODE3.st.com (10.75.127.9) To SFHDAG4NODE2.st.com (10.75.127.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-12_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gabriel Fernandez This patch fixes the following static checker warning: drivers/input/keyboard/st-keyscan.c:156 keyscan_probe() error: potential zalloc NULL dereference: 'keypad_data->input_dev' Reported-by: Dan Carpenter Signed-off-by: Gabriel Fernandez --- drivers/input/keyboard/st-keyscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c index babcfb165e4f..3b85631fde91 100644 --- a/drivers/input/keyboard/st-keyscan.c +++ b/drivers/input/keyboard/st-keyscan.c @@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev) input_dev->id.bustype = BUS_HOST; + keypad_data->input_dev = input_dev; + error = keypad_matrix_key_parse_dt(keypad_data); if (error) return error; @@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev) input_set_drvdata(input_dev, keypad_data); - keypad_data->input_dev = input_dev; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); keypad_data->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(keypad_data->base)) -- 2.17.0