diff mbox series

[v3,3/8] media: qcom: camss: Fix potential crash if domain attach fails

Message ID 20241011140932.1744124-4-quic_vikramsa@quicinc.com
State New
Headers show
Series [v3,1/8] media: dt-bindings: media: camss: Add qcom,sc7280-camss binding | expand

Commit Message

Vikram Sharma Oct. 11, 2024, 2:09 p.m. UTC
Fix a potential crash in camss by ensuring detach is skipped if attach
is unsuccessful.

Fixes: d89751c61279 ("media: qcom: camss: Add support for named power-domains")
CC: stable@vger.kernel.org
Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com>
---
 drivers/media/platform/qcom/camss/camss.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index d64985ca6e88..b6658df37709 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -2131,8 +2131,7 @@  static int camss_configure_pd(struct camss *camss)
 		camss->genpd = dev_pm_domain_attach_by_name(camss->dev,
 							    camss->res->pd_name);
 		if (IS_ERR(camss->genpd)) {
-			ret = PTR_ERR(camss->genpd);
-			goto fail_pm;
+			return PTR_ERR(camss->genpd);
 		}
 	}
 
@@ -2149,7 +2148,7 @@  static int camss_configure_pd(struct camss *camss)
 			ret = -ENODEV;
 		else
 			ret = PTR_ERR(camss->genpd);
-		goto fail_pm;
+		return ret;
 	}
 	camss->genpd_link = device_link_add(camss->dev, camss->genpd,
 					    DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME |