Skip to content

Commit

Permalink
HID: alps: fix error return code in alps_input_configured()
Browse files Browse the repository at this point in the history
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.

[jkosina@suse.cz: ammend changelog]
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Wei Yongjun authored and Jiri Kosina committed Sep 22, 2016
1 parent 3da30bf commit 46a41b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/hid/hid-alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)

input2 = input_allocate_device();
if (!input2) {
input_free_device(input2);
ret = -ENOMEM;
goto exit;
}

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

if (input_register_device(data->input2)) {
ret = input_register_device(data->input2);
if (ret) {
input_free_device(input2);
goto exit;
}
Expand Down

0 comments on commit 46a41b5

Please sign in to comment.