Patch "pwm: stm32-lp: Add check for clk_enable()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    pwm: stm32-lp: Add check for clk_enable()

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pwm-stm32-lp-add-check-for-clk_enable.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8873787bf20051b878e24ef43eaf1a98d7829ee2
Author: Mingwei Zheng <zmw12306@xxxxxxxxx>
Date:   Fri Dec 6 16:53:18 2024 -0500

    pwm: stm32-lp: Add check for clk_enable()
    
    [ Upstream commit cce16e7f6216227964cda25f5f23634bce2c500f ]
    
    Add check for the return value of clk_enable() to catch the potential
    error.
    We used APP-Miner to find it.
    
    Fixes: e70a540b4e02 ("pwm: Add STM32 LPTimer PWM driver")
    Signed-off-by: Mingwei Zheng <zmw12306@xxxxxxxxx>
    Signed-off-by: Jiasheng Jiang <jiashengjiangcool@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20241206215318.3402860-1-zmw12306@xxxxxxxxx
    Signed-off-by: Uwe Kleine-König <ukleinek@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c
index 20657c649c65e..f03dd7799f864 100644
--- a/drivers/pwm/pwm-stm32-lp.c
+++ b/drivers/pwm/pwm-stm32-lp.c
@@ -169,8 +169,12 @@ static void stm32_pwm_lp_get_state(struct pwm_chip *chip,
 	regmap_read(priv->regmap, STM32_LPTIM_CR, &val);
 	state->enabled = !!FIELD_GET(STM32_LPTIM_ENABLE, val);
 	/* Keep PWM counter clock refcount in sync with PWM initial state */
-	if (state->enabled)
-		clk_enable(priv->clk);
+	if (state->enabled) {
+		int ret = clk_enable(priv->clk);
+
+		if (ret)
+			return ret;
+	}
 
 	regmap_read(priv->regmap, STM32_LPTIM_CFGR, &val);
 	presc = FIELD_GET(STM32_LPTIM_PRESC, val);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux