Skip to contentSkip to conversation

HID: alps: fix error return code in alps_input_configured()

PATCH In review Wei Yongjun 3 participants 3 messages Sep 21, 2016 – Sep 22, 2016 HID

lore
Share & tools
lore
#0 lore raw

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
index 2808da9..507372e 100644
@@ -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;
 		}
Reviewed-by on v1 1/1
#1 lore raw
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.

---
 drivers/hid/hid-alps.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hid/hid-alps.c +0 -0
index 2808da9..507372e 100644

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;
 		}
maintainer
#2 lore raw
Quoted 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.

---
 drivers/hid/hid-alps.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hid/hid-alps.c +0 -0
index 2808da9..507372e 100644

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).

Quoted 1 line

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