Message ID | fe86b3ad145c5df3b16b09a83769f078bb4a9d1f.1608735481.git.simon@simonsouth.net |
---|---|
State | Changes Requested |
Headers | show |
Series | pwm: rockchip: Eliminate potential race condition when probing | expand |
Hello Simon, On Wed, Dec 23, 2020 at 11:01:04AM -0500, Simon South wrote: > If rockchip_pwm_probe() fails to register a PWM device it calls > clk_unprepare() for the device's PWM clock, without having first disabled > the clock and before jumping to an error handler that also unprepares > it. The "without having first disabled the clock" part is wrong without the first patch. I suggest to swap the order of the first and second patch. Best regards Uwe
diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c index d2058138ce1e..0c940c7508ea 100644 --- a/drivers/pwm/pwm-rockchip.c +++ b/drivers/pwm/pwm-rockchip.c @@ -353,7 +353,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev) ret = pwmchip_add(&pc->chip); if (ret < 0) { - clk_unprepare(pc->clk); dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); goto err_pclk; }
If rockchip_pwm_probe() fails to register a PWM device it calls clk_unprepare() for the device's PWM clock, without having first disabled the clock and before jumping to an error handler that also unprepares it. This is likely to produce warnings from the kernel about the clock being unprepared when it is still enabled, and then being unprepared when it has already been unprepared. Prevent these warnings by removing this unnecessary call to clk_unprepare(). Fixes: 48cf973cae33 ("pwm: rockchip: Avoid glitches on already running PWMs") Signed-off-by: Simon South <simon@simonsouth.net> --- drivers/pwm/pwm-rockchip.c | 1 - 1 file changed, 1 deletion(-)