Message ID | 20240904-camss_on_sc7280_rb3gen2_vision_v2_patches-v1-3-b18ddcd7d9df@quicinc.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | (no cover subject) | expand |
On 4.09.2024 1:10 PM, Vikram Sharma wrote: > 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, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c > index d64985ca6e88..447b89d07e8a 100644 > --- a/drivers/media/platform/qcom/camss/camss.c > +++ b/drivers/media/platform/qcom/camss/camss.c > @@ -2132,7 +2132,7 @@ static int camss_configure_pd(struct camss *camss) > camss->res->pd_name); > if (IS_ERR(camss->genpd)) { > ret = PTR_ERR(camss->genpd); > - goto fail_pm; > + goto fail_pm_attach; > } > } > > @@ -2149,7 +2149,7 @@ static int camss_configure_pd(struct camss *camss) > ret = -ENODEV; > else > ret = PTR_ERR(camss->genpd); > - goto fail_pm; > + goto fail_pm_attach; > } > camss->genpd_link = device_link_add(camss->dev, camss->genpd, > DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | > @@ -2164,6 +2164,7 @@ static int camss_configure_pd(struct camss *camss) > fail_pm: > dev_pm_domain_detach(camss->genpd, true); > > +fail_pm_attach: > return ret; What's the point, just call return directly where you added the goto Konrad
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index d64985ca6e88..447b89d07e8a 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -2132,7 +2132,7 @@ static int camss_configure_pd(struct camss *camss) camss->res->pd_name); if (IS_ERR(camss->genpd)) { ret = PTR_ERR(camss->genpd); - goto fail_pm; + goto fail_pm_attach; } } @@ -2149,7 +2149,7 @@ static int camss_configure_pd(struct camss *camss) ret = -ENODEV; else ret = PTR_ERR(camss->genpd); - goto fail_pm; + goto fail_pm_attach; } camss->genpd_link = device_link_add(camss->dev, camss->genpd, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | @@ -2164,6 +2164,7 @@ static int camss_configure_pd(struct camss *camss) fail_pm: dev_pm_domain_detach(camss->genpd, true); +fail_pm_attach: return ret; }
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, 3 insertions(+), 2 deletions(-)