On Thu, Nov 05, 2026 at 02:38:10PM +0000, Lee Jones wrote: > img_pwm_remove() disables runtime PM and gates the peripheral clocks via > img_pwm_runtime_suspend() before calling pwmchip_remove(). While the > PWM chip is still registered, a consumer can call img_pwm_apply(), where > pm_runtime_resume_and_get() returns -EACCES or succeeds without > re-enabling clocks, leading to unclocked register access. > > Call pwmchip_remove() before disabling runtime PM and suspending the > device. > > Fixes: 277bb6a29e00 ("pwm: Imagination Technologies PWM DAC driver") > Closes: https://sashiko.dev/#/bug/linux-b06bab8d-dbf2-4ba2-9f5d-c5e141076abd > Cc: stable@vger.kernel.org > Signed-off-by: Lee Jones > --- > drivers/pwm/pwm-img.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c > index 91e0b19f0c08..b6e090674c07 100644 > --- a/drivers/pwm/pwm-img.c > +++ b/drivers/pwm/pwm-img.c > @@ -338,11 +338,11 @@ static void img_pwm_remove(struct platform_device *pdev) > { > struct pwm_chip *chip = platform_get_drvdata(pdev); > > - pm_runtime_disable(&pdev->dev); > - if (!pm_runtime_status_suspended(&pdev->dev)) > - img_pwm_runtime_suspend(&pdev->dev); > - > pwmchip_remove(chip); > + > + pm_runtime_disable(&pdev->dev); > + if (!pm_runtime_status_suspended(&pdev->dev)) > + img_pwm_runtime_suspend(&pdev->dev); Calling pm_runtime_disable() might result in a call to img_pwm_runtime_resume() (does it?). In img_pwm_runtime_resume() we have: struct pwm_chip *chip = dev_get_drvdata(dev); struct img_pwm_chip *imgchip = to_img_pwm_chip(chip); ... which doesn't look like an operation that should be done after pwmchip_remove()? Best regards Uwe