Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 841cf676 authored by Robin Murphy's avatar Robin Murphy Committed by Guenter Roeck
Browse files

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: default avatarRobin Murphy <robin.murphy@arm.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 6b1ec478
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -328,7 +328,7 @@ static int pwm_fan_probe(struct platform_device *pdev)


	ret = pwm_apply_state(ctx->pwm, &state);
	ret = pwm_apply_state(ctx->pwm, &state);
	if (ret) {
	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;
		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,
		ret = devm_request_irq(&pdev->dev, ctx->irq, pulse_handler, 0,
				       pdev->name, ctx);
				       pdev->name, ctx);
		if (ret) {
		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;
			goto err_pwm_disable;
		}
		}
		ctx->sample_start = ktime_get();
		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",
	hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, "pwmfan",
						       ctx, pwm_fan_groups);
						       ctx, pwm_fan_groups);
	if (IS_ERR(hwmon)) {
	if (IS_ERR(hwmon)) {
		dev_err(&pdev->dev, "Failed to register hwmon device\n");
		ret = PTR_ERR(hwmon);
		ret = PTR_ERR(hwmon);
		dev_err(&pdev->dev,
			"Failed to register hwmon device: %d\n", ret);
		goto err_del_timer;
		goto err_del_timer;
	}
	}


@@ -371,9 +373,10 @@ static int pwm_fan_probe(struct platform_device *pdev)
							  "pwm-fan", ctx,
							  "pwm-fan", ctx,
							  &pwm_fan_cooling_ops);
							  &pwm_fan_cooling_ops);
		if (IS_ERR(cdev)) {
		if (IS_ERR(cdev)) {
			dev_err(&pdev->dev,
				"Failed to register pwm-fan as cooling device");
			ret = PTR_ERR(cdev);
			ret = PTR_ERR(cdev);
			dev_err(&pdev->dev,
				"Failed to register pwm-fan as cooling device: %d\n",
				ret);
			goto err_del_timer;
			goto err_del_timer;
		}
		}
		ctx->cdev = cdev;
		ctx->cdev = cdev;