Skip to content

Commit

Permalink
HID: nintendo: Add missing array termination
Browse files Browse the repository at this point in the history
joycon_dpad_inputs_jc[] is unterminated. This may result in odd warnings
such as

input: input_set_capability: invalid code 3077588140 for type 1

or in kernel crashes in nintendo_hid_probe(). Terminate the array to fix
the problem.

Fixes: 2af16c1 ("HID: nintendo: add nintendo switch controller driver")
Cc: Daniel J. Ogorchock <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Reviewed-by: Dmitry Torokhov <[email protected]>
Cc: [email protected]
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
groeck authored and Jiri Kosina committed Jul 21, 2022
1 parent 12ffcd7 commit ab5f340
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hid/hid-nintendo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@ static const unsigned int joycon_button_inputs_r[] = {
/* We report joy-con d-pad inputs as buttons and pro controller as a hat. */
static const unsigned int joycon_dpad_inputs_jc[] = {
BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT,
0 /* 0 signals end of array */
};

static int joycon_input_create(struct joycon_ctlr *ctlr)
Expand Down

0 comments on commit ab5f340

Please sign in to comment.