HID: alps: fix error return code in alps_input_configured()
PATCH 1/1 HID: alps: fix error return code in alps_input_configured()
From: Wei Yongjun <[email protected]>
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/hid/hid-alps.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hid/hid-alps.c +3 -2
@@ -384,7 +384,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; }
@@ -426,7 +426,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; }
Quoted 15 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
Signed-off-by Wei Yongjun <[email protected]>--- drivers/hid/hid-alps.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/hid/hid-alps.c +0
-0
drivers/hid/hid-alps.c static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) · line 387
Quoted 4 lines
drivers/hid/hid-alps.c +0
-1@@ -384,7 +384,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) input2 =input_allocate_device ();if (!input2) { -input_free_device (input2);
Tiny nitpick: this change is not entirely related to the patch and commit message. But it's OK-ish carrying this over through this patch. (it's basically a no-op given that input2 is null).
Cheers,
Benjamin
Quoted 17 lines
drivers/hid/hid-alps.c +3
-1+ ret = -ENOMEM ; goto exit; }@@ -426,7 +426,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; }
Jiri Kosina
maintainerQuoted 22 lines · Benjamin Tissoires
Quoted 13 lines
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
Signed-off-by Wei Yongjun <[email protected]>--- drivers/hid/hid-alps.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/hid/hid-alps.c +0
-0drivers/hid/hid-alps.c static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) · line 387
Quoted 4 lines
drivers/hid/hid-alps.c +0
-1@@ -384,7 +384,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) input2 =input_allocate_device ();if (!input2) { -input_free_device (input2);Tiny nitpick: this change is not entirely related to the patch and commit message. But it's OK-ish carrying this over through this patch. (it's basically a no-op given that input2 is null).
Quoted 1 line
Reviewed-by Benjamin Tissoires <[email protected]>
Fair enough; I've ammended the changelog to reflect the removal of superfluous input_free_device() call and applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs