* [PATCH] usb: typec: tipd: Free IRQ only if it was requested before
@ 2024-08-16 12:41 Wadim Egorov
2024-08-19 11:13 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Wadim Egorov @ 2024-08-16 12:41 UTC (permalink / raw)
To: linux-kernel, linux-usb
Cc: upstream, heikki.krogerus, gregkh, javier.carrasco, abdelalkuor,
harshit.m.mogalapalli
In polling mode, if no IRQ was requested there is no need to free it.
Call devm_free_irq() only if client->irq is set. This fixes the warning
caused by the tps6598x module removal:
WARNING: CPU: 2 PID: 333 at kernel/irq/devres.c:144 devm_free_irq+0x80/0x8c
...
...
Call trace:
devm_free_irq+0x80/0x8c
tps6598x_remove+0x28/0x88 [tps6598x]
i2c_device_remove+0x2c/0x9c
device_remove+0x4c/0x80
device_release_driver_internal+0x1cc/0x228
driver_detach+0x50/0x98
bus_remove_driver+0x6c/0xbc
driver_unregister+0x30/0x60
i2c_del_driver+0x54/0x64
tps6598x_i2c_driver_exit+0x18/0xc3c [tps6598x]
__arm64_sys_delete_module+0x184/0x264
invoke_syscall+0x48/0x110
el0_svc_common.constprop.0+0xc8/0xe8
do_el0_svc+0x20/0x2c
el0_svc+0x28/0x98
el0t_64_sync_handler+0x13c/0x158
el0t_64_sync+0x190/0x194
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
drivers/usb/typec/tipd/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index dd51a25480bf..256b0c054e9a 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -1465,8 +1465,9 @@ static void tps6598x_remove(struct i2c_client *client)
if (!client->irq)
cancel_delayed_work_sync(&tps->wq_poll);
+ else
+ devm_free_irq(tps->dev, client->irq, tps);
- devm_free_irq(tps->dev, client->irq, tps);
tps6598x_disconnect(tps, 0);
typec_unregister_port(tps->port);
usb_role_switch_put(tps->role_sw);
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: typec: tipd: Free IRQ only if it was requested before
2024-08-16 12:41 [PATCH] usb: typec: tipd: Free IRQ only if it was requested before Wadim Egorov
@ 2024-08-19 11:13 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2024-08-19 11:13 UTC (permalink / raw)
To: Wadim Egorov
Cc: linux-kernel, linux-usb, upstream, gregkh, javier.carrasco,
abdelalkuor, harshit.m.mogalapalli
On Fri, Aug 16, 2024 at 02:41:50PM +0200, Wadim Egorov wrote:
> In polling mode, if no IRQ was requested there is no need to free it.
> Call devm_free_irq() only if client->irq is set. This fixes the warning
> caused by the tps6598x module removal:
>
> WARNING: CPU: 2 PID: 333 at kernel/irq/devres.c:144 devm_free_irq+0x80/0x8c
> ...
> ...
> Call trace:
> devm_free_irq+0x80/0x8c
> tps6598x_remove+0x28/0x88 [tps6598x]
> i2c_device_remove+0x2c/0x9c
> device_remove+0x4c/0x80
> device_release_driver_internal+0x1cc/0x228
> driver_detach+0x50/0x98
> bus_remove_driver+0x6c/0xbc
> driver_unregister+0x30/0x60
> i2c_del_driver+0x54/0x64
> tps6598x_i2c_driver_exit+0x18/0xc3c [tps6598x]
> __arm64_sys_delete_module+0x184/0x264
> invoke_syscall+0x48/0x110
> el0_svc_common.constprop.0+0xc8/0xe8
> do_el0_svc+0x20/0x2c
> el0_svc+0x28/0x98
> el0t_64_sync_handler+0x13c/0x158
> el0t_64_sync+0x190/0x194
>
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tipd/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index dd51a25480bf..256b0c054e9a 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -1465,8 +1465,9 @@ static void tps6598x_remove(struct i2c_client *client)
>
> if (!client->irq)
> cancel_delayed_work_sync(&tps->wq_poll);
> + else
> + devm_free_irq(tps->dev, client->irq, tps);
>
> - devm_free_irq(tps->dev, client->irq, tps);
> tps6598x_disconnect(tps, 0);
> typec_unregister_port(tps->port);
> usb_role_switch_put(tps->role_sw);
> --
> 2.34.1
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-19 11:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-16 12:41 [PATCH] usb: typec: tipd: Free IRQ only if it was requested before Wadim Egorov
2024-08-19 11:13 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®