Skip to contentSkip to conversation

pinctrl: pinmux: Update error reporting in pin_request()

PATCH New Jernej Skrabec 1 participant 3 messages Sep 9, 2023

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

v2 cover pinctrl: pinmux: Update error reporting in pin_request()

Currently pin_request() may prints two error messages for same error. Additionally, it also prints error message when status is -EPROBE_DEFER.

Fix that by removing duplicate error reporting and use dev_err_probe() instead of ordinary dev_err().

Best regards,
Jernej

Changes from v1:
- fixed dev_err_probe() arguments

Jernej Skrabec (2):
pinctrl: pinmux: Remove duplicate error message in pin_request()
pinctrl: pinmux: Use dev_err_probe() in pin_request()

 drivers/pinctrl/pinmux.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
Signature · 1 line
2.42.0
#1 lore raw

PATCH v2 1/2 pinctrl: pinmux: Remove duplicate error message in pin_request()

Detailed error message is already printed at the end of the function, so drop redundant one a few lines earlier.

---
 drivers/pinctrl/pinmux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pinctrl/pinmux.c +1 -3
index 2a180a5d64a4..301fe0157b02 100644
@@ -173,10 +173,8 @@ static int pin_request(struct pinctrl_dev *pctldev,
 	else
 		status = 0;
 
-	if (status) {
-		dev_err(pctldev->dev, "request() failed for pin %d\n", pin);
+	if (status)
 		module_put(pctldev->owner);
-	}
 
 out_free_pin:
 	if (status) {
Signature · 1 line
2.42.0
#2 lore raw

PATCH v2 2/2 pinctrl: pinmux: Use dev_err_probe() in pin_request()

In reply to Jernej Skrabec

Use dev_err_probe() when printing error message in pin_request() since it may fail with -EPROBE_DEFER.

---
 drivers/pinctrl/pinmux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinmux.c +2 -2
index 301fe0157b02..0ecd74ce5890 100644
@@ -188,8 +188,8 @@ static int pin_request(struct pinctrl_dev *pctldev,
 	}
 out:
 	if (status)
-		dev_err(pctldev->dev, "pin-%d (%s) status %d\n",
-			pin, owner, status);
+		dev_err_probe(pctldev->dev, status, "pin-%d (%s)\n",
+			      pin, owner);
 
 	return status;
 }
Signature · 1 line
2.42.0