summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorGabriel Fernandez <gabriel.fernandez@st.com>2019-02-16 21:10:16 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-23 13:19:42 +0100
commit2e0e73d7b82e2432446f544d0492435146a0af37 (patch)
tree1f19a0a62e570d2c65f72cc87fe4194df86f28bf /drivers/input
parent9f7ae2d5c74947dcf942e4c86e5c72bc84c42c6b (diff)
Input: st-keyscan - fix potential zalloc NULL dereference
[ Upstream commit 2439d37e1bf8a34d437573c086572abe0f3f1b15 ] 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 <dan.carpenter@oracle.com> Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/st-keyscan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
index de7be4f03d91..ebf9f643d910 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))