Skip to content

Commit 6d3daa9

Browse files
author
Sudeep Holla
committed
firmware: arm_ffa: Unregister bus notifier on teardown for FF-A v1.0
For FF-A v1.0 the driver registers a bus notifier to backfill UUID matching, but the notifier was never unregistered on cleanup paths. Track the registration state and unregister it during teardown and early partition-setup failure. Fixes: 9dd1593 ("firmware: arm_ffa: Move the FF-A v1.0 NULL UUID workaround to bus notifier") Link: https://patch.msgid.link/20260428-ffa_fixes-v2-5-8595ae450034@kernel.org Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
1 parent 9985d53 commit 6d3daa9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/firmware/arm_ffa/driver.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct ffa_drv_info {
101101
bool mem_ops_native;
102102
bool msg_direct_req2_supp;
103103
bool bitmap_created;
104+
bool bus_notifier_registered;
104105
bool notif_enabled;
105106
unsigned int sched_recv_irq;
106107
unsigned int notif_pend_irq;
@@ -1630,6 +1631,15 @@ static struct notifier_block ffa_bus_nb = {
16301631
.notifier_call = ffa_bus_notifier,
16311632
};
16321633

1634+
static void ffa_bus_notifier_unregister(void)
1635+
{
1636+
if (!drv_info->bus_notifier_registered)
1637+
return;
1638+
1639+
bus_unregister_notifier(&ffa_bus_type, &ffa_bus_nb);
1640+
drv_info->bus_notifier_registered = false;
1641+
}
1642+
16331643
static int ffa_xa_add_partition_info(struct ffa_device *dev)
16341644
{
16351645
struct ffa_dev_part_info *info;
@@ -1713,6 +1723,8 @@ static void ffa_partitions_cleanup(void)
17131723
struct list_head *phead;
17141724
unsigned long idx;
17151725

1726+
ffa_bus_notifier_unregister();
1727+
17161728
/* Clean up/free all registered devices */
17171729
ffa_devices_unregister();
17181730

@@ -1740,11 +1752,14 @@ static int ffa_setup_partitions(void)
17401752
ret = bus_register_notifier(&ffa_bus_type, &ffa_bus_nb);
17411753
if (ret)
17421754
pr_err("Failed to register FF-A bus notifiers\n");
1755+
else
1756+
drv_info->bus_notifier_registered = true;
17431757
}
17441758

17451759
count = ffa_partition_probe(&uuid_null, &pbuf);
17461760
if (count <= 0) {
17471761
pr_info("%s: No partitions found, error %d\n", __func__, count);
1762+
ffa_bus_notifier_unregister();
17481763
return -EINVAL;
17491764
}
17501765

0 commit comments

Comments
 (0)