Re: [PATCH] hid:Add missing error checking in mt_probe for creating sysfs_create_group

2 messages, 2 authors, 2016-02-03 · open the first message on its own page

Re: [PATCH] hid:Add missing error checking in mt_probe for creating sysfs_create_group

From: Benjamin Tissoires <hidden>
Date: 2016-02-03 08:24:00

On Feb 02 2016 or thereabouts, Nicholas Krause wrote:
quoted hunk
This adds the missing error check in the function mt_probe for
the call to the function sysfs_create_group for creating the
group,mt_attrribute as based on the based input device's device
kobject's member as otherwise we assume the sysfs directory is
created successfully no matter the return value of
sysfs_create_group.

Signed-off-by: Nicholas Krause <redacted>
---
 drivers/hid/hid-multitouch.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 296d499..46ebf06 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1133,6 +1133,8 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return ret;
 
 	ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
+	if (ret)
+		return ret;
I am not particularly happy with a hard failure here in case the sysfs
group doesn't bind. The group is mainly used for debug, and I am not
sure anybody but me uses it nowadays.

Could you amend the patch to put a warning in case of a failure but
still continue?

Cheers,
Benjamin
 
 	mt_set_maxcontacts(hdev);
 	mt_set_input_mode(hdev);
-- 
2.5.0

Re: [PATCH] hid:Add missing error checking in mt_probe for creating sysfs_create_group

From: Jiri Kosina <jikos@kernel.org>
Date: 2016-02-03 09:14:27

On Wed, 3 Feb 2016, Benjamin Tissoires wrote:
quoted
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 296d499..46ebf06 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1133,6 +1133,8 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return ret;
 
 	ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
+	if (ret)
+		return ret;
I am not particularly happy with a hard failure here in case the sysfs
group doesn't bind. The group is mainly used for debug, and I am not
sure anybody but me uses it nowadays.

Could you amend the patch to put a warning in case of a failure but
still continue?
Yeah. And also in case of hard failure, some cleanup would have to be done 
anyway (hid_hw_start() has already happened, etc).

-- 
Jiri Kosina
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help