Re: [PATCH 1/4] pwm: omap-dmtimer: remove pwmchip in .remove before making it unfunctional

From: Markus Elfring
Date: Mon Nov 11 2019 - 08:30:53 EST


> In the old code (e.g.) mutex_destroy() was called before
> pwmchip_remove(). Between these two calls it is possible that a pwm
> callback is used which tries to grab the mutex.

How do you think about to add a more âimperative moodâ for your
change description?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c#n151


> +++ b/drivers/pwm/pwm-omap-dmtimer.c
> @@ -351,6 +351,11 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
> static int pwm_omap_dmtimer_remove(struct platform_device *pdev)
> {
> struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev);
> + int ret;
> +
> + ret = pwmchip_remove(&omap->chip);
> + if (ret)
> + return ret;
>
> if (pm_runtime_active(&omap->dm_timer_pdev->dev))
> omap->pdata->stop(omap->dm_timer);

How do you think about to use the following statement variant?

+ int ret = pwmchip_remove(&omap->chip);

Regards,
Markus