Skip to content

Commit

Permalink
Input: st-keyscan - fix potential zalloc NULL dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gabriel Fernandez authored and Dmitry Torokhov committed Feb 17, 2019
1 parent 1cd48dc commit 2439d37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/keyboard/st-keyscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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))
Expand Down

0 comments on commit 2439d37

Please sign in to comment.