Message ID | 20230822200626.1931129-2-bryan.odonoghue@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | media: qcom: camss: Bugfix series | expand |
Hi Bryan, Thank you for the patch. On Tue, Aug 22, 2023 at 09:06:18PM +0100, Bryan O'Donoghue wrote: > We need to make sure camss_configure_pd() happens before > camss_register_entities() as the vfe_get() path relies on the pointer > provided by camss_configure_pd(). > > Fix the ordering sequence in probe to ensure the pointers vfe_get() demands > are present by the time camss_register_entities() runs. > > In order to facilitate backporting to stable kernels I've moved the > configure_pd() call pretty early on the probe() function so that > irrespective of the existence of the old error handling jump labels this > patch should still apply to -next circa Aug 2023 to v5.13 inclusive. > > Fixes: 2f6f8af67203 ("media: camss: Refactor VFE power domain toggling") > Cc: stable@vger.kernel.org > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> It seems like the device links and power domains won't be properly cleaned up if probe fails. The problem predates this patch though, so even if moving genpd initialization may make it worse, it's not a reason to block this patch. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Maybe a patch further in the series will fix this :-) > --- > drivers/media/platform/qcom/camss/camss.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c > index f11dc59135a5a..75991d849b571 100644 > --- a/drivers/media/platform/qcom/camss/camss.c > +++ b/drivers/media/platform/qcom/camss/camss.c > @@ -1619,6 +1619,12 @@ static int camss_probe(struct platform_device *pdev) > if (ret < 0) > goto err_cleanup; > > + ret = camss_configure_pd(camss); > + if (ret < 0) { > + dev_err(dev, "Failed to configure power domains: %d\n", ret); > + goto err_cleanup; > + } > + > ret = camss_init_subdevices(camss); > if (ret < 0) > goto err_cleanup; > @@ -1678,12 +1684,6 @@ static int camss_probe(struct platform_device *pdev) > } > } > > - ret = camss_configure_pd(camss); > - if (ret < 0) { > - dev_err(dev, "Failed to configure power domains: %d\n", ret); > - return ret; > - } > - > pm_runtime_enable(dev); > > return 0;
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index f11dc59135a5a..75991d849b571 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1619,6 +1619,12 @@ static int camss_probe(struct platform_device *pdev) if (ret < 0) goto err_cleanup; + ret = camss_configure_pd(camss); + if (ret < 0) { + dev_err(dev, "Failed to configure power domains: %d\n", ret); + goto err_cleanup; + } + ret = camss_init_subdevices(camss); if (ret < 0) goto err_cleanup; @@ -1678,12 +1684,6 @@ static int camss_probe(struct platform_device *pdev) } } - ret = camss_configure_pd(camss); - if (ret < 0) { - dev_err(dev, "Failed to configure power domains: %d\n", ret); - return ret; - } - pm_runtime_enable(dev); return 0;
We need to make sure camss_configure_pd() happens before camss_register_entities() as the vfe_get() path relies on the pointer provided by camss_configure_pd(). Fix the ordering sequence in probe to ensure the pointers vfe_get() demands are present by the time camss_register_entities() runs. In order to facilitate backporting to stable kernels I've moved the configure_pd() call pretty early on the probe() function so that irrespective of the existence of the old error handling jump labels this patch should still apply to -next circa Aug 2023 to v5.13 inclusive. Fixes: 2f6f8af67203 ("media: camss: Refactor VFE power domain toggling") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- drivers/media/platform/qcom/camss/camss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)