[PATCH v2 2/5] HID: hid-betopff.c: Refactor code to fix error handling (2/3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HID: hid-betopff.c: Refactor code to fix error handling (2/3)

The driver's betopff_probe() calls betopff_init(), but then doesn't
handle the returned errors. This is a minor refactoring to fold both
functions into one and bring back error handling.

Signed-off-by: Hanno Zulla <kontakt@xxxxxxxx>
---
 drivers/hid/hid-betopff.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
index 5b4c9e9d26ae..0ba58f748239 100644
--- a/drivers/hid/hid-betopff.c
+++ b/drivers/hid/hid-betopff.c
@@ -55,7 +55,7 @@ static int hid_betopff_play(struct input_dev *dev, void *data,
 	return 0;
 }
 
-static int betopff_init(struct hid_device *hid)
+static int betopff_init(struct hid_device *hdev)
 {
 	struct betopff_device *betopff;
 	struct hid_report *report;
@@ -65,9 +65,9 @@ static int betopff_init(struct hid_device *hid)
 	int error;
 	int i, j;
 
-	report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+	report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
 	if (list_empty(report_list)) {
-		hid_err(hid, "no output reports found\n");
+		hid_err(hdev, "no output reports found\n");
 		return -ENODEV;
 	}
 
@@ -88,7 +88,7 @@ static int betopff_init(struct hid_device *hid)
 	}
 
 	if (field_count < 4) {
-		hid_err(hid, "not enough fields in the report: %d\n",
+		hid_err(hdev, "not enough fields in the report: %d\n",
 				field_count);
 		return -ENODEV;
 	}
@@ -97,7 +97,7 @@ static int betopff_init(struct hid_device *hid)
 	if (!betopff)
 		return -ENOMEM;
 
-	hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
+	hidinput = list_first_entry(&hdev->inputs, struct hid_input, list);
 	set_bit(FF_RUMBLE, hidinput->input->ffbit);
 
 	error = input_ff_create_memless(hidinput->input,
@@ -108,9 +108,9 @@ static int betopff_init(struct hid_device *hid)
 	}
 
 	betopff->report = report;
-	hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);
+	hid_hw_request(hdev, betopff->report, HID_REQ_SET_REPORT);
 
-	hid_info(hid, "Force feedback for betop devices by huangbo <huangbobupt@xxxxxxx>\n");
+	hid_info(hdev, "Force feedback for betop devices by huangbo <huangbobupt@xxxxxxx>\n");
 
 	return 0;
 }
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux