[PATCH] pwm: stm32-lp: Add check for clk_enable()

Uwe Kleine-König ukleinek at kernel.org
Thu Dec 5 00:34:32 PST 2024


On Thu, Dec 05, 2024 at 12:17:46AM -0500, Mingwei Zheng wrote:
> Add check for the return value of clk_enable() to catch the potential
> error.

Is this something that you actually hit, or just a janitoral fix you
noticed while browsing the code (or reading some checker output)?

> Fixes: e70a540b4e02 ("pwm: Add STM32 LPTimer PWM driver")
> Signed-off-by: Mingwei Zheng <zmw12306 at gmail.com>
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool at gmail.com>
> ---
>  drivers/pwm/pwm-stm32-lp.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c
> index 989731256f50..4abef304417d 100644
> --- a/drivers/pwm/pwm-stm32-lp.c
> +++ b/drivers/pwm/pwm-stm32-lp.c
> @@ -163,12 +163,16 @@ static int stm32_pwm_lp_get_state(struct pwm_chip *chip,
>  	unsigned long rate = clk_get_rate(priv->clk);
>  	u32 val, presc, prd;
>  	u64 tmp;
> +	int ret;

Please move this variable to the block where it's used. No need for such
a big scope.

Otherwise looks fine.

Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20241205/3297cc26/attachment.sig>


More information about the linux-arm-kernel mailing list