mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] pwm: Fix incorrect variable used in error message
@ 2025-09-02 13:03 Colin Ian King
  2025-09-09 10:52 ` Uwe Kleine-König
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2025-09-02 13:03 UTC (permalink / raw)
  To: Uwe Kleine-König, linux-pwm; +Cc: kernel-janitors, linux-kernel

The dev_err message is reporting the incorrect return value ret_tohw,
it should be reporting the value in ret_fromhw. Fix this by using
ret_fromhw instead of ret_tohw.

Fixes: 6c5126c6406d ("pwm: Provide new consumer API functions for waveforms")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/pwm/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index ec4112e6209a..ea2ccf42e814 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -276,7 +276,7 @@ int pwm_round_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *
 
 	if (IS_ENABLED(CONFIG_PWM_DEBUG) && ret_fromhw > 0)
 		dev_err(&chip->dev, "Unexpected return value from __pwm_round_waveform_fromhw: requested %llu/%llu [+%llu], return value %d\n",
-			wf_req.duty_length_ns, wf_req.period_length_ns, wf_req.duty_offset_ns, ret_tohw);
+			wf_req.duty_length_ns, wf_req.period_length_ns, wf_req.duty_offset_ns, ret_fromhw);
 
 	if (IS_ENABLED(CONFIG_PWM_DEBUG) &&
 	    (ret_tohw == 0) != pwm_check_rounding(&wf_req, wf))
-- 
2.51.0


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

* Re: [PATCH][next] pwm: Fix incorrect variable used in error message
  2025-09-02 13:03 [PATCH][next] pwm: Fix incorrect variable used in error message Colin Ian King
@ 2025-09-09 10:52 ` Uwe Kleine-König
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2025-09-09 10:52 UTC (permalink / raw)
  To: Colin Ian King; +Cc: linux-pwm, kernel-janitors, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]

On Tue, Sep 02, 2025 at 02:03:48PM +0100, Colin Ian King wrote:
> The dev_err message is reporting the incorrect return value ret_tohw,
> it should be reporting the value in ret_fromhw. Fix this by using
> ret_fromhw instead of ret_tohw.
> 
> Fixes: 6c5126c6406d ("pwm: Provide new consumer API functions for waveforms")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/pwm/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index ec4112e6209a..ea2ccf42e814 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -276,7 +276,7 @@ int pwm_round_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *
>  
>  	if (IS_ENABLED(CONFIG_PWM_DEBUG) && ret_fromhw > 0)
>  		dev_err(&chip->dev, "Unexpected return value from __pwm_round_waveform_fromhw: requested %llu/%llu [+%llu], return value %d\n",
> -			wf_req.duty_length_ns, wf_req.period_length_ns, wf_req.duty_offset_ns, ret_tohw);
> +			wf_req.duty_length_ns, wf_req.period_length_ns, wf_req.duty_offset_ns, ret_fromhw);
>  
>  	if (IS_ENABLED(CONFIG_PWM_DEBUG) &&
>  	    (ret_tohw == 0) != pwm_check_rounding(&wf_req, wf))

Indeed, thanks for the fix. I added it to my pwm/fixes branch at
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git. I
didn't made my mind up yet if the patches contained in there are
relevant enough to send it to Linus before 6.17.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2025-09-09 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-02 13:03 [PATCH][next] pwm: Fix incorrect variable used in error message Colin Ian King
2025-09-09 10:52 ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®