Skip to contentSkip to conversation

HID: emsff: properly handle emsff_init failure

PATCH In review Axel Lin 2 participants 2 messages Jul 19, 2011 – Jul 20, 2011 HID

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 HID: emsff: properly handle emsff_init failure

emsff_init() may fail, let's properly handle the failure.

---
 drivers/hid/hid-emsff.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/hid/hid-emsff.c +6 -1
index 81877c6..a5dc13f 100644
@@ -126,7 +126,12 @@ static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		goto err;
 	}
 
-	emsff_init(hdev);
+	ret = emsff_init(hdev);
+	if (ret) {
+		dev_err(&hdev->dev, "force feedback init failed\n");
+		hid_hw_stop(hdev);
+		goto err;
+	}
 
 	return 0;
 err:
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 15 lines · Axel Lin

emsff_init() may fail, let's properly handle the failure.

---
 drivers/hid/hid-emsff.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/hid/hid-emsff.c +0 -0
index 81877c6..a5dc13f 100644
@@ -126,7 +126,12 @@ static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		goto err;
 	}
 

drivers/hid/hid-emsff.c static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id) · line 137

Quoted 10 lines
drivers/hid/hid-emsff.c +6 -1
-	emsff_init(hdev);
+	ret = emsff_init(hdev);
+	if (ret) {
+		dev_err(&hdev->dev, "force feedback init failed\n");
+		hid_hw_stop(hdev);
+		goto err;
+	}
 
 	return 0;
 err:

Good catch, applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs