Skip to contentSkip to conversation

PCI: endpoint: Print the EPF name in the error log of pci_epf_make()

PATCH Applied Manivannan Sadhasivam 3 participants 5 messages Mar 5 – Mar 26

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 PCI: endpoint: Print the EPF name in the error log of pci_epf_make()

From: Manivannan Sadhasivam <[email protected]>

Merely printing the error log without the actual EPF name will not give much clue to the users about the failure. Hence, print the EPF name also.

---
 drivers/pci/endpoint/pci-ep-cfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/endpoint/pci-ep-cfs.c +2 -1
index 076d115db02b..a19db22b7991 100644
@@ -625,7 +625,8 @@ static struct config_group *pci_epf_make(struct config_group *group,
 	epf = pci_epf_create(epf_name);
 	if (IS_ERR(epf)) {
 		err = PTR_ERR(epf);
-		pr_err("failed to create endpoint function device: %d\n", err);
+		pr_err("failed to create endpoint function device (%s): %d\n",
+			epf_name, err);
 		goto free_name;
 	}
 
Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 PCI: endpoint: Improve error messages

From: Manivannan Sadhasivam <[email protected]>

Include errno in the error prints and also use dev_err() where applicable.

---
 drivers/pci/endpoint/pci-ep-cfs.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/pci/endpoint/pci-ep-cfs.c +10 -5
index a19db22b7991..2d2efd444b02 100644
@@ -565,7 +565,8 @@ static void pci_ep_cfs_add_type_group(struct pci_epf_group *epf_group)
 
 	if (IS_ERR(group)) {
 		dev_err(&epf_group->epf->dev,
-			"failed to create epf type specific attributes\n");
+			"failed to create epf type specific attributes: %d\n",
+			(int)PTR_ERR(group));
 		return;
 	}
 
@@ -578,13 +579,17 @@ static void pci_epf_cfs_add_sub_groups(struct pci_epf_group *epf_group)
 
 	group = pci_ep_cfs_add_primary_group(epf_group);
 	if (IS_ERR(group)) {
-		pr_err("failed to create 'primary' EPC interface\n");
+		dev_err(&epf_group->epf->dev,
+			"failed to create 'primary' EPC interface: %d\n",
+			(int)PTR_ERR(group));
 		return;
 	}
 
 	group = pci_ep_cfs_add_secondary_group(epf_group);
 	if (IS_ERR(group)) {
-		pr_err("failed to create 'secondary' EPC interface\n");
+		dev_err(&epf_group->epf->dev,
+			"failed to create 'secondary' EPC interface: %d\n",
+			(int)PTR_ERR(group));
 		return;
 	}
 
@@ -675,8 +680,8 @@ struct config_group *pci_ep_cfs_add_epf_group(const char *name)
 	group = configfs_register_default_group(functions_group, name,
 						&pci_epf_group_type);
 	if (IS_ERR(group))
-		pr_err("failed to register configfs group for %s function\n",
-		       name);
+		pr_err("failed to register configfs group for %s function: %d\n",
+		       name, (int)PTR_ERR(group));
 
 	return group;
 }
Signature · 1 line
2.51.0
#2 lore raw

Re: [PATCH 2/2] PCI: endpoint: Improve error messages

Quoted 24 lines · Manivannan Sadhasivam

From: Manivannan Sadhasivam<[email protected]>

Include errno in the error prints and also use dev_err() where applicable.

---
  drivers/pci/endpoint/pci-ep-cfs.c | 15 ++++++++++-----
  1 file changed, 10 insertions(+), 5 deletions(-)
drivers/pci/endpoint/pci-ep-cfs.c +2 -1
index a19db22b7991..2d2efd444b02 100644
@@ -565,7 +565,8 @@ static void pci_ep_cfs_add_type_group(struct pci_epf_group *epf_group)
 
  	if (IS_ERR(group)) {
  		dev_err(&epf_group->epf->dev,
-			"failed to create epf type specific attributes\n");
+			"failed to create epf type specific attributes: %d\n",
+			(int)PTR_ERR(group));
  		return;
  	}
 

drivers/pci/endpoint/pci-ep-cfs.c static void pci_epf_cfs_add_sub_groups(struct pci_epf_group *epf_group) · line 584

Quoted 7 lines
drivers/pci/endpoint/pci-ep-cfs.c +3 -1
@@ -578,13 +579,17 @@ static void pci_epf_cfs_add_sub_groups(struct pci_epf_group *epf_group)
 
  	group = pci_ep_cfs_add_primary_group(epf_group);
  	if (IS_ERR(group)) {
-		pr_err("failed to create 'primary' EPC interface\n");
+		dev_err(&epf_group->epf->dev,
+			"failed to create 'primary' EPC interface: %d\n",
+			(int)PTR_ERR(group));

using (int) not wrong but it is a bit unusual, in this case can we use "%pe" instead ? "failed to create 'primary' EPC interface: %pe\n", group)

drivers/pci/endpoint/pci-ep-cfs.c static void pci_epf_cfs_add_sub_groups(struct pci_epf_group *epf_group) · line 586

Quoted 2 lines
drivers/pci/endpoint/pci-ep-cfs.c +0 -0
  		return;
  	}

Thanks,
Alok

author Applied
#4 lore raw
In reply to Manivannan Sadhasivam
Quoted 2 lines · Manivannan Sadhasivam

Merely printing the error log without the actual EPF name will not give much clue to the users about the failure. Hence, print the EPF name also.

Applied, thanks!

[1/2] PCI: endpoint: Print the EPF name in the error log of pci_epf_make()

      commit: ff5387d4f0798cf1d1a4f548427bd9142cf35b66
[2/2] PCI: endpoint: Improve error messages
      commit: 396d44dcaf8d367ed15ecec30e2f69c62f93306c

Best regards,

Signature · 1 line
Manivannan Sadhasivam <[email protected]>
#3 lore raw

Re: [PATCH 2/2] PCI: endpoint: Improve error messages

In reply to ALOK TIWARI
Quoted 27 lines · ALOK TIWARI
Quoted 24 lines · Manivannan Sadhasivam

From: Manivannan Sadhasivam<[email protected]>

Include errno in the error prints and also use dev_err() where applicable.

---
  drivers/pci/endpoint/pci-ep-cfs.c | 15 ++++++++++-----
  1 file changed, 10 insertions(+), 5 deletions(-)
drivers/pci/endpoint/pci-ep-cfs.c +2 -1
index a19db22b7991..2d2efd444b02 100644
@@ -565,7 +565,8 @@ static void pci_ep_cfs_add_type_group(struct pci_epf_group *epf_group)
  	if (IS_ERR(group)) {
  		dev_err(&epf_group->epf->dev,
-			"failed to create epf type specific attributes\n");
+			"failed to create epf type specific attributes: %d\n",
+			(int)PTR_ERR(group));
  		return;
  	}
@@ -578,13 +579,17 @@ static void pci_epf_cfs_add_sub_groups(struct pci_epf_group *epf_group)
  	group = pci_ep_cfs_add_primary_group(epf_group);
  	if (IS_ERR(group)) {
Quoted 9 lines

drivers/pci/endpoint/pci-ep-cfs.c static void pci_epf_cfs_add_sub_groups(struct pci_epf_group *epf_group) · line 584

Quoted 4 lines
drivers/pci/endpoint/pci-ep-cfs.c +3 -1
-		pr_err("failed to create 'primary' EPC interface\n");
+		dev_err(&epf_group->epf->dev,
+			"failed to create 'primary' EPC interface: %d\n",
+			(int)PTR_ERR(group));

using (int) not wrong but it is a bit unusual, in this case can we use "%pe" instead ?
"failed to create 'primary' EPC interface: %pe\n", group)

Agree. Amended this change while applying, thanks!

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்