diff options
| author | Andrew Goodbody <[email protected]> | 2025-08-08 10:34:43 +0100 |
|---|---|---|
| committer | Neil Armstrong <[email protected]> | 2025-09-30 20:32:15 +0200 |
| commit | b1e2cbd65cdfbc32c222eccedac11f53390694cf (patch) | |
| tree | 380a300f8fc85a26066ab62c8a7f12c9f1962745 | |
| parent | bb2d7ea6f2a8b9539f9daf526b5f87c29ce413b4 (diff) | |
pwm: meson: Stop premature exit from for loop
In meson_pwm_probe the for loop attempts to get the name of a clock but
the following if..else statements only perform useful work if -ENODATA
is returned from clk_get_by_name. If clk_get_by_name simply succeeds
then this results in a premature exit from the for loop and the
following code can never be reached. Make the else clause only apply for
an error return from clk_get_by_name.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <[email protected]>
Reviewed-by: Neil Armstrong <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Neil Armstrong <[email protected]>
| -rw-r--r-- | drivers/pwm/pwm-meson.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index c2597d8b669..caa7af085fa 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -359,8 +359,9 @@ static int meson_pwm_probe(struct udevice *dev) /* We have our source clock, do not alter HW clock mux */ continue; - } else + } else if (err) { return err; + } /* Get id in list */ for (p = 0 ; p < data->num_parents ; ++p) { |
