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 <andrew.goodbody@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250808-pwm_meson-v1-1-cddb7e5f76bd@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
This commit is contained in:
Andrew Goodbody 2025-08-08 10:34:43 +01:00 committed by Neil Armstrong
parent bb2d7ea6f2
commit b1e2cbd65c

View File

@ -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) {