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

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

 



HID: hid-betopff.c: Refactor code to fix error handling (1/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 69cfc8dc6af1..5b4c9e9d26ae 100644
--- a/drivers/hid/hid-betopff.c
+++ b/drivers/hid/hid-betopff.c
@@ -59,15 +59,13 @@ static int betopff_init(struct hid_device *hid)
 {
 	struct betopff_device *betopff;
 	struct hid_report *report;
-	struct hid_input *hidinput =
-			list_first_entry(&hid->inputs, struct hid_input, list);
-	struct list_head *report_list =
-			&hid->report_enum[HID_OUTPUT_REPORT].report_list;
-	struct input_dev *dev = hidinput->input;
+	struct hid_input *hidinput;
+	struct list_head *report_list;
 	int field_count = 0;
 	int error;
 	int i, j;
 
+	report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
 	if (list_empty(report_list)) {
 		hid_err(hid, "no output reports found\n");
 		return -ENODEV;
@@ -99,9 +97,11 @@ static int betopff_init(struct hid_device *hid)
 	if (!betopff)
 		return -ENOMEM;
 
-	set_bit(FF_RUMBLE, dev->ffbit);
+	hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
+	set_bit(FF_RUMBLE, hidinput->input->ffbit);
 
-	error = input_ff_create_memless(dev, betopff, hid_betopff_play);
+	error = input_ff_create_memless(hidinput->input,
+			betopff, hid_betopff_play);
 	if (error) {
 		kfree(betopff);
 		return error;
-- 
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