aboutsummaryrefslogtreecommitdiff
path: root/drivers/fsi
diff options
context:
space:
mode:
authorEddie James2023-08-09 13:08:14 -0500
committerJoel Stanley2023-08-11 13:32:14 +0930
commitb1d3a803acfa900611d5a1393fc4aef801cb1385 (patch)
treeafa4c49642196c9d7d0af2f752c9c15e84db97cd /drivers/fsi
parentadde0e112c6365c6a930a3d8cd0c7a4accd55adc (diff)
fsi: Lock mutex for master device registration
Because master device registration may cause hub master scans, or user scans may begin before device registration has ended, so the master scan lock must be held while registering the device. Signed-off-by: Eddie James <eajames@linux.ibm.com> Link: https://lore.kernel.org/r/20230809180814.151984-3-eajames@linux.ibm.com Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/fsi')
-rw-r--r--drivers/fsi/fsi-core.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 90872e2e78d1..097d5a780264 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1326,20 +1326,20 @@ int fsi_master_register(struct fsi_master *master)
master->dev.class = &fsi_master_class;
+ mutex_lock(&master->scan_lock);
rc = device_register(&master->dev);
if (rc) {
ida_free(&master_ida, master->idx);
- return rc;
+ goto out;
}
np = dev_of_node(&master->dev);
if (!of_property_read_bool(np, "no-scan-on-init")) {
- mutex_lock(&master->scan_lock);
fsi_master_scan(master);
- mutex_unlock(&master->scan_lock);
}
-
- return 0;
+out:
+ mutex_unlock(&master->scan_lock);
+ return rc;
}
EXPORT_SYMBOL_GPL(fsi_master_register);