Skip to content

Commit 46a41b5

Browse files
Wei YongjunJiri Kosina
authored andcommitted
HID: alps: fix error return code in alps_input_configured()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. While at it, remove redundant input_free_device(NULL) call. [[email protected]: ammend changelog] Signed-off-by: Wei Yongjun <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 3da30bf commit 46a41b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/hid/hid-alps.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
383383

384384
input2 = input_allocate_device();
385385
if (!input2) {
386-
input_free_device(input2);
386+
ret = -ENOMEM;
387387
goto exit;
388388
}
389389

@@ -425,7 +425,8 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
425425
__set_bit(INPUT_PROP_POINTER, input2->propbit);
426426
__set_bit(INPUT_PROP_POINTING_STICK, input2->propbit);
427427

428-
if (input_register_device(data->input2)) {
428+
ret = input_register_device(data->input2);
429+
if (ret) {
429430
input_free_device(input2);
430431
goto exit;
431432
}

0 commit comments

Comments
 (0)