Skip to contentSkip to conversation

usbip: vhci_hcd indicate failed message

PATCH Superseded Mao Wenan 4 participants 7 messages Sep 15, 2019 – Sep 16, 2019

Subsystems (3)
lore
Share & tools
lore

Mao Wenan

author
#0 lore raw

PATCH 1/1 usbip: vhci_hcd indicate failed message

If the return value of vhci_init_attr_group and sysfs_create_group is non-zero, which mean they failed to init attr_group and create sysfs group, so it would better add 'failed' message to indicate that.

Fixes 0775a9cbc694 ("usbip: vhci extension: modifications to vhci driver")
---
 drivers/usb/usbip/vhci_hcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/usbip/vhci_hcd.c +2 -2
index 000ab7225717..dd54c95d2498 100644
@@ -1185,12 +1185,12 @@ static int vhci_start(struct usb_hcd *hcd)
 	if (id == 0 && usb_hcd_is_primary_hcd(hcd)) {
 		err = vhci_init_attr_group();
 		if (err) {
-			pr_err("init attr group\n");
+			pr_err("init attr group failed\n");
 			return err;
 		}
 		err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
 		if (err) {
-			pr_err("create sysfs files\n");
+			pr_err("create sysfs failed\n");
 			vhci_finish_attr_group();
 			return err;
 		}
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 16 lines · Mao Wenan

If the return value of vhci_init_attr_group and sysfs_create_group is non-zero, which mean they failed to init attr_group and create sysfs group, so it would better add 'failed' message to indicate that.

Fixes 0775a9cbc694 ("usbip: vhci extension: modifications to vhci driver")
---
 drivers/usb/usbip/vhci_hcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/usbip/vhci_hcd.c +0 -0
index 000ab7225717..dd54c95d2498 100644

drivers/usb/usbip/vhci_hcd.c static int vhci_start(struct usb_hcd *hcd) · line 1188

Quoted 5 lines
drivers/usb/usbip/vhci_hcd.c +1 -1
@@ -1185,12 +1185,12 @@ static int vhci_start(struct usb_hcd *hcd)
 	if (id = 0 && usb_hcd_is_primary_hcd(hcd)) {
 		err = vhci_init_attr_group();
 		if (err) {
-			pr_err("init attr group\n");
+			pr_err("init attr group failed\n");

dev_err() would also be good to use here.

drivers/usb/usbip/vhci_hcd.c static int vhci_start(struct usb_hcd *hcd) · line 1193

Quoted 6 lines
drivers/usb/usbip/vhci_hcd.c +1 -1
 			return err;
 		}
 		err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
 		if (err) {
-			pr_err("create sysfs files\n");
+			pr_err("create sysfs failed\n");

Same here.

thanks,

greg k-h

#2 lore raw
In reply to Mao Wenan

Am 15.09.2019 05:43, schrieb Mao Wenan:

Quoted 17 lines

If the return value of vhci_init_attr_group and sysfs_create_group is non-zero, which mean they failed to init attr_group and create sysfs group, so it would better add 'failed' message to indicate that.

Fixes 0775a9cbc694 ("usbip: vhci extension: modifications to vhci driver")
---
 drivers/usb/usbip/vhci_hcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/usbip/vhci_hcd.c +0 -0
index 000ab7225717..dd54c95d2498 100644
@@ -1185,12 +1185,12 @@ static int vhci_start(struct usb_hcd *hcd)
 	if (id = 0 && usb_hcd_is_primary_hcd(hcd)) {

drivers/usb/usbip/vhci_hcd.c static int vhci_start(struct usb_hcd *hcd) · line 1193

Quoted 10 lines
drivers/usb/usbip/vhci_hcd.c +2 -2
 		err = vhci_init_attr_group();
 		if (err) {
-			pr_err("init attr group\n");
+			pr_err("init attr group failed\n");
 			return err;
 		}
 		err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
 		if (err) {
-			pr_err("create sysfs files\n");
+			pr_err("create sysfs failed\n");

I guess "sysfs files" is here intended ?

re,
wh

Quoted 3 lines
drivers/usb/usbip/vhci_hcd.c +0 -0
 			vhci_finish_attr_group();
 			return err;
 		}
author
#3 lore raw

PATCH v2 1/1 usbip: vhci_hcd indicate failed message

If the return value of vhci_init_attr_group and sysfs_create_group is non-zero, which mean they failed to init attr_group and create sysfs group, so it would better add 'failed' message to indicate that. This patch also change pr_err to dev_err to trace which device is failed.

Fixes 0775a9cbc694 ("usbip: vhci extension: modifications to vhci driver")

---
v2: change pr_err to dev_err.

 drivers/usb/usbip/vhci_hcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/usbip/vhci_hcd.c +2 -2
index 000ab7225717..bea28ec846ee 100644
@@ -1185,12 +1185,12 @@ static int vhci_start(struct usb_hcd *hcd)
 	if (id == 0 && usb_hcd_is_primary_hcd(hcd)) {
 		err = vhci_init_attr_group();
 		if (err) {
-			pr_err("init attr group\n");
+			dev_err(hcd_dev(hcd), "init attr group failed\n");
 			return err;
 		}
 		err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
 		if (err) {
-			pr_err("create sysfs files\n");
+			dev_err(hcd_dev(hcd), "create sysfs files failed\n");
 			vhci_finish_attr_group();
 			return err;
 		}
Signature · 1 line
2.20.1
maintainer
#4 lore raw
Quoted 19 lines · Mao Wenan

If the return value of vhci_init_attr_group and sysfs_create_group is non-zero, which mean they failed to init attr_group and create sysfs group, so it would better add 'failed' message to indicate that. This patch also change pr_err to dev_err to trace which device is failed.

Fixes 0775a9cbc694 ("usbip: vhci extension: modifications to vhci driver")

---
v2: change pr_err to dev_err.

  drivers/usb/usbip/vhci_hcd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/usbip/vhci_hcd.c +0 -0
index 000ab7225717..bea28ec846ee 100644

drivers/usb/usbip/vhci_hcd.c static int vhci_start(struct usb_hcd *hcd) · line 1188

Quoted 5 lines
drivers/usb/usbip/vhci_hcd.c +1 -1
@@ -1185,12 +1185,12 @@ static int vhci_start(struct usb_hcd *hcd)
  	if (id = 0 && usb_hcd_is_primary_hcd(hcd)) {
  		err = vhci_init_attr_group();
  		if (err) {
-			pr_err("init attr group\n");
+			dev_err(hcd_dev(hcd), "init attr group failed\n");

Why not include err information in the message. Helps figure out why it failed.

drivers/usb/usbip/vhci_hcd.c static int vhci_start(struct usb_hcd *hcd) · line 1196

Quoted 10 lines
drivers/usb/usbip/vhci_hcd.c +1 -1
  			return err;
  		}
  		err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
  		if (err) {
-			pr_err("create sysfs files\n");
+			dev_err(hcd_dev(hcd), "create sysfs files failed\n");
  			vhci_finish_attr_group();
  			return err;
  		}

Why not include err information in the message. Helps figure out why it failed.

thanks,
-- Shuah

author
#5 lore raw

PATCH v3 1/1 usbip: vhci_hcd indicate failed message

If the return value of vhci_init_attr_group and sysfs_create_group is non-zero, which mean they failed to init attr_group and create sysfs group, so it would better add 'failed' message to indicate that. This patch also change pr_err to dev_err to trace which device is failed.

Fixes 0775a9cbc694 ("usbip: vhci extension: modifications to vhci driver")

---
v2: change pr_err to dev_err.
v3: add error code in failed messages.

 drivers/usb/usbip/vhci_hcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/usbip/vhci_hcd.c +2 -2
index 000ab7225717..144507751eae 100644
@@ -1185,12 +1185,12 @@ static int vhci_start(struct usb_hcd *hcd)
 	if (id == 0 && usb_hcd_is_primary_hcd(hcd)) {
 		err = vhci_init_attr_group();
 		if (err) {
-			pr_err("init attr group\n");
+			dev_err(hcd_dev(hcd), "init attr group failed, err = %d\n", err);
 			return err;
 		}
 		err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
 		if (err) {
-			pr_err("create sysfs files\n");
+			dev_err(hcd_dev(hcd), "create sysfs files failed, err = %d\n", err);
 			vhci_finish_attr_group();
 			return err;
 		}
Signature · 1 line
2.20.1
maintainer Acked-by Shuah Khan on v3 1/1
#6 lore raw
Quoted 25 lines · Mao Wenan

If the return value of vhci_init_attr_group and sysfs_create_group is non-zero, which mean they failed to init attr_group and create sysfs group, so it would better add 'failed' message to indicate that. This patch also change pr_err to dev_err to trace which device is failed.

Fixes 0775a9cbc694 ("usbip: vhci extension: modifications to vhci driver")

---
v2: change pr_err to dev_err.
v3: add error code in failed messages.

  drivers/usb/usbip/vhci_hcd.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/usbip/vhci_hcd.c +0 -1
index 000ab7225717..144507751eae 100644
@@ -1185,12 +1185,12 @@ static int vhci_start(struct usb_hcd *hcd)
  	if (id = 0 && usb_hcd_is_primary_hcd(hcd)) {
  		err = vhci_init_attr_group();
  		if (err) {
-			pr_err("init attr group\n");

drivers/usb/usbip/vhci_hcd.c static int vhci_start(struct usb_hcd *hcd) · line 1196

Quoted 10 lines
drivers/usb/usbip/vhci_hcd.c +2 -1
+			dev_err(hcd_dev(hcd), "init attr group failed, err = %d\n", err);
  			return err;
  		}
  		err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
  		if (err) {
-			pr_err("create sysfs files\n");
+			dev_err(hcd_dev(hcd), "create sysfs files failed, err = %d\n", err);
  			vhci_finish_attr_group();
  			return err;
  		}

Looks good to me.

thanks,
-- Shuah