Skip to content

Commit 6d67cbe

Browse files
committed
firmware: arm_ffa: Fix FFA notifications cleanup path
We allow the FF-A to be initialised successfully even when notification fails. When the notification fails, ffa_notifications_cleanup() gets called on the failure path. However, the driver information about the notifications like the irq, workqueues and cpu hotplug state for enabling and disabling percpu IRQ are not cleared. This may result in unexpected behaviour during CPU hotplug because of percpu IRQ being enabled and disabled or during the driver removal when ffa_notifications_cleanup() gets executed again. Fix the FFA notifications cleanup path by clearing all the notification related driver information. Link: https://lore.kernel.org/r/[email protected] Tested-by: Jens Wiklander <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent f4bfcae commit 6d67cbe

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/firmware/arm_ffa/driver.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,8 +1326,10 @@ static int ffa_sched_recv_irq_map(void)
13261326

13271327
static void ffa_sched_recv_irq_unmap(void)
13281328
{
1329-
if (drv_info->sched_recv_irq)
1329+
if (drv_info->sched_recv_irq) {
13301330
irq_dispose_mapping(drv_info->sched_recv_irq);
1331+
drv_info->sched_recv_irq = 0;
1332+
}
13311333
}
13321334

13331335
static int ffa_cpuhp_pcpu_irq_enable(unsigned int cpu)
@@ -1344,17 +1346,23 @@ static int ffa_cpuhp_pcpu_irq_disable(unsigned int cpu)
13441346

13451347
static void ffa_uninit_pcpu_irq(void)
13461348
{
1347-
if (drv_info->cpuhp_state)
1349+
if (drv_info->cpuhp_state) {
13481350
cpuhp_remove_state(drv_info->cpuhp_state);
1351+
drv_info->cpuhp_state = 0;
1352+
}
13491353

1350-
if (drv_info->notif_pcpu_wq)
1354+
if (drv_info->notif_pcpu_wq) {
13511355
destroy_workqueue(drv_info->notif_pcpu_wq);
1356+
drv_info->notif_pcpu_wq = NULL;
1357+
}
13521358

13531359
if (drv_info->sched_recv_irq)
13541360
free_percpu_irq(drv_info->sched_recv_irq, drv_info->irq_pcpu);
13551361

1356-
if (drv_info->irq_pcpu)
1362+
if (drv_info->irq_pcpu) {
13571363
free_percpu(drv_info->irq_pcpu);
1364+
drv_info->irq_pcpu = NULL;
1365+
}
13581366
}
13591367

13601368
static int ffa_init_pcpu_irq(unsigned int irq)

0 commit comments

Comments
 (0)