linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: max77693-haptic: Make use of the helper function dev_err_probe()
@ 2022-02-16  5:33 zhaoxiao
  0 siblings, 0 replies; only message in thread
From: zhaoxiao @ 2022-02-16  5:33 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: krzysztof.kozlowski, linux-input, linux-kernel, zhaoxiao

devm_pwm_get() can return -EPROBE_DEFER if the pwm regulator is not
ready yet. Use dev_err_probe() for pwm regulator resources
to indicate the deferral reason when waiting for the
resource to come up.

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
---
 drivers/input/misc/max77693-haptic.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c
index 4369d3c04d38..787ea6d0d64d 100644
--- a/drivers/input/misc/max77693-haptic.c
+++ b/drivers/input/misc/max77693-haptic.c
@@ -325,11 +325,9 @@ static int max77693_haptic_probe(struct platform_device *pdev)
 
 	/* Get pwm and regulatot for haptic device */
 	haptic->pwm_dev = devm_pwm_get(&pdev->dev, NULL);
-	if (IS_ERR(haptic->pwm_dev)) {
-		dev_err(&pdev->dev, "failed to get pwm device\n");
-		return PTR_ERR(haptic->pwm_dev);
-	}
-
+	if (IS_ERR(haptic->pwm_dev))
+		return dev_err_probe(&pdev->dev, PTR_ERR(haptic->pwm_dev),
+				"failed to get pwm device\n");
 	/*
 	 * FIXME: pwm_apply_args() should be removed when switching to the
 	 * atomic PWM API.
-- 
2.20.1




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-16  5:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16  5:33 [PATCH] input: max77693-haptic: Make use of the helper function dev_err_probe() zhaoxiao

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).