diff mbox series

[libpwm,1/4] sysfs: Fix a wrong condition for duty_cycle writing

Message ID edbef643dbd7489f232aee478e5b2d512c6db437.1751995302.git.u.kleine-koenig@baylibre.com
State Accepted
Headers show
Series sysfs: Various fixes and an improvement | expand

Commit Message

Uwe Kleine-König July 8, 2025, 5:24 p.m. UTC
It's an invalid cache that must result in setting the duty_cycle
explicitly. In this else branch it's already known that cache_valid is
true. So the damage is small and the condition can just be dropped.

Fixes: 67f0b9f2a2aa ("First prototype for libpwm")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
 sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/sysfs.c b/sysfs.c
index fe4edea1e102..0f87f2b87028 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -212,8 +212,7 @@  static int pwm_chip_sysfs_set_waveform(struct pwm *pwm,
 			pwm_sysfs->wf.duty_length_ns = wf->duty_length_ns;
 		}
 	} else {
-		if (!!pwm_sysfs->cache_valid ||
-		    pwm_sysfs->wf.duty_length_ns != wf->duty_length_ns) {
+		if (pwm_sysfs->wf.duty_length_ns != wf->duty_length_ns) {
 			ret = pwm_chip_sysfs_write_prop(pwm_sysfs, "duty_cycle",
 							"%" PRIu64 "\n", wf->duty_length_ns);
 			if (ret)