Potential uninitialized variables in pwm: stm32-lp

From: Yizhuo Zhai
Date: Fri Oct 04 2019 - 00:52:49 EST


Hi All:

drivers/pwm/pwm-stm32-lp.c:

Variable "val" and "prd" in function stm32_pwm_lp_get_state() could be
uninitialized
if regmap_read() returns -EINVAL. But it's directly used later without
the return check,
which is potentially unsafe.

Also, we cannot simply return -EINVAL in stm32_pwm_lp_get_state() because the
return type is void.

Thanks for your time to check this case.
--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside