linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] hwmon: pwm-fan: Report probe errors consistently
@ 2019-04-12 14:05 Robin Murphy
  2019-04-12 17:36 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Murphy @ 2019-04-12 14:05 UTC (permalink / raw)
  To: linux, kamil, b.zolnierkie, jdelvare
  Cc: stefan.wahren, linux-hwmon, linux-kernel

Printing the error code for a failure provides a head-start for
debugging, since it's often sufficient to pinpoint the origin of the
failure. We already do this for some probe-failure messages, so let's
make the rest of them consistent.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---

This is based on Stefan's "[PATCH V5 3/3] hwmon: pwm-fan: Add RPM support
via external interrupt"
 
 drivers/hwmon/pwm-fan.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 8c4c5eefd4ca..556db4bef743 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -330,7 +330,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
 
 	ret = pwm_apply_state(ctx->pwm, &state);
 	if (ret) {
-		dev_err(&pdev->dev, "Failed to configure PWM\n");
+		dev_err(&pdev->dev, "Failed to configure PWM: %d\n", ret);
 		goto err_reg_disable;
 	}
 
@@ -348,7 +348,8 @@ static int pwm_fan_probe(struct platform_device *pdev)
 		ret = devm_request_irq(&pdev->dev, ctx->irq, pulse_handler, 0,
 				       pdev->name, ctx);
 		if (ret) {
-			dev_err(&pdev->dev, "Can't get interrupt working.\n");
+			dev_err(&pdev->dev,
+				"Failed to request interrupt: %d\n", ret);
 			goto err_pwm_disable;
 		}
 		ctx->sample_start = ktime_get();
@@ -358,8 +359,9 @@ static int pwm_fan_probe(struct platform_device *pdev)
 	hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, "pwmfan",
 						       ctx, pwm_fan_groups);
 	if (IS_ERR(hwmon)) {
-		dev_err(&pdev->dev, "Failed to register hwmon device\n");
 		ret = PTR_ERR(hwmon);
+		dev_err(&pdev->dev,
+			"Failed to register hwmon device: %d\n", ret);
 		goto err_del_timer;
 	}
 
@@ -373,9 +375,10 @@ static int pwm_fan_probe(struct platform_device *pdev)
 							  "pwm-fan", ctx,
 							  &pwm_fan_cooling_ops);
 		if (IS_ERR(cdev)) {
-			dev_err(&pdev->dev,
-				"Failed to register pwm-fan as cooling device");
 			ret = PTR_ERR(cdev);
+			dev_err(&pdev->dev,
+				"Failed to register pwm-fan as cooling device: %d\n",
+				ret);
 			goto err_del_timer;
 		}
 		ctx->cdev = cdev;
-- 
2.21.0.dirty


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] hwmon: pwm-fan: Report probe errors consistently
  2019-04-12 14:05 [PATCH RESEND] hwmon: pwm-fan: Report probe errors consistently Robin Murphy
@ 2019-04-12 17:36 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-04-12 17:36 UTC (permalink / raw)
  To: Robin Murphy
  Cc: kamil, b.zolnierkie, jdelvare, stefan.wahren, linux-hwmon, linux-kernel

On Fri, Apr 12, 2019 at 03:05:23PM +0100, Robin Murphy wrote:
> Printing the error code for a failure provides a head-start for
> debugging, since it's often sufficient to pinpoint the origin of the
> failure. We already do this for some probe-failure messages, so let's
> make the rest of them consistent.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

Applied to hwmon-next.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-12 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 14:05 [PATCH RESEND] hwmon: pwm-fan: Report probe errors consistently Robin Murphy
2019-04-12 17:36 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).