[03/10] media: qcom: camss: Fix potential crash if domain attach fails
Checks
Context |
Check |
Description |
media-ci/HTML_report |
success
|
Link
|
media-ci/report |
success
|
Link
|
media-ci/bisect |
success
|
Link
|
media-ci/doc |
success
|
Link
|
media-ci/build |
success
|
Link
|
media-ci/static-upstream |
success
|
Link
|
media-ci/abi |
success
|
Link
|
media-ci/media-patchstyle |
fail
|
Link
|
media-ci/checkpatch |
success
|
Link
|
Commit Message
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(-)
Comments
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
@@ -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;
}