summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2019-04-12 15:05:23 +0100
committerGuenter Roeck <linux@roeck-us.net>2019-04-15 17:19:53 -0700
commit841cf6767bf6eb047fb8ede6c2a2d50976ec5ec9 (patch)
tree42a12763d22a99930b752db4de5663b218d77f93 /drivers
parent6b1ec4789fb17890a7f95e72670a9393fd9f8c8f (diff)
downloadlinux-841cf6767bf6eb047fb8ede6c2a2d50976ec5ec9.tar.gz
hwmon: (pwm-fan) Report probe errors consistently
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>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/pwm-fan.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 285ec3abb85e..eead8afe6447 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -328,7 +328,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;
 	}
 
@@ -346,7 +346,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();
@@ -356,8 +357,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;
 	}
 
@@ -371,9 +373,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;