Skip to contentSkip to conversation

fsi: check ida_simple_get() return value

PATCH Superseded Bo Liu 1 participant 1 message Sep 7, 2022 FSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bo Liu

author
#0 lore raw

PATCH 1/1 fsi: check ida_simple_get() return value

As ida_simple_get() can fail, we should check the return value.

---
 drivers/fsi/fsi-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/fsi/fsi-core.c +4 -1
index 0d11a17c53a0..c009c9b30ba1 100644
@@ -1313,7 +1313,10 @@ int fsi_master_register(struct fsi_master *master)
 	struct device_node *np;
 
 	mutex_init(&master->scan_lock);
-	master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
+	rc = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
+	if (rc < 0)
+		return rc;
+	master->idx = rc;
 	dev_set_name(&master->dev, "fsi%d", master->idx);
 	master->dev.class = &fsi_master_class;
 
Signature · 1 line
2.27.0