[PATCH 1/3] soc: qcom: apr: Remove service from IDR before registration failure
From: Srinivas Kandagatla
Date: Thu May 14 2026 - 11:53:13 EST
apr_add_device() may fail before device register, do cleanup of idr from
global apr->svcs_idr list so that we are not leaving any stale id in the
list.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
---
drivers/soc/qcom/apr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
index ea7f83916d8d..127204c195ea 100644
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -466,6 +466,7 @@ static int apr_add_device(struct device *dev, struct device_node *np,
1, &adev->service_path);
if (ret < 0 && ret != -EINVAL) {
dev_err(dev, "Failed to read second value of qcom,protection-domain\n");
+ idr_remove(&apr->svcs_idr, svc_id);
goto out;
}
--
2.47.3