Re: [PATCH -next v2 1/2] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()

From: Yang Yingliang
Date: Sat Sep 17 2022 - 07:20:06 EST


Hi,

On 2022/9/17 16:54, andy.shevchenko@xxxxxxxxx wrote:
Sat, Sep 17, 2022 at 10:46:33AM +0800, Yang Yingliang kirjoitti:
Add the missing destroy_workqueue() before return from ocelot_pinctrl_probe()
in error path.

Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
v2:
move alloc_ordered_workqueue() after ocelot_pinctrl_register().
Why? What will happen if user space start using pins before workqueue is allocated?
This is a suggestion from Horatiu Vultur.

And I think the workqueue is used in ocelot_irq_unmask_level(), but before ocelot_gpiochip_register() calling,
the irq is not prepared, the work won't be queued before ocelot_gpiochip_register().

If you really want to have it correct, you need either drop all devm_ calls
after allocating workqueue, or wrap destroying into devm.
I am trying to add devm APIs for allocating workqueue.

Thanks,
Yang