Fix the error path of probe functions in
Subsystems (2)
v3 cover Fix the error path of probe functions in
This patch set fixes the error path of probe functions in qcom_q6v5_{adsp,pas,wcss}.c by removnig subdevs and deinitializing qcom_q6v5.
Changes since v2:
- Fix the error path of q6v5_wcss_probe() in qcom_q6v5_wcss.c
Changes since v1:
- Fix the error path of adsp_probe() in qcom_q6v5_adsp.c
- Add appropriate Fixes tags.
Joe Hattori (3):
remoteproc: qcom: pas: Remove subdevs on the error path of
adsp_probe()
remoteproc: qcom: adsp: Remove subdevs on the error path of
adsp_probe()
remoteproc: qcom: wcss: Remove subdevs on the error path of
q6v5_wcss_probe()
drivers/remoteproc/qcom_q6v5_adsp.c | 11 +++++++++-- drivers/remoteproc/qcom_q6v5_pas.c | 20 +++++++++++++++----- drivers/remoteproc/qcom_q6v5_wcss.c | 19 +++++++++++++++++-- 3 files changed, 41 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1
PATCH v3 1/3 remoteproc: qcom: pas: Remove subdevs on the error path of adsp_probe()
Current implementation of adsp_probe() in qcom_q6v5_pas.c does not remove the subdevs of adsp on the error path. Fix this bug by calling qcom_remove_{ssr,sysmon,pdm,smd,glink}_subdev(), qcom_q6v5_deinit(), and adsp_unassign_memory_region() appropriately.
--- drivers/remoteproc/qcom_q6v5_pas.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/remoteproc/qcom_q6v5_pas.c +15 -5
@@ -759,16 +759,16 @@ static int adsp_probe(struct platform_device *pdev) ret =adsp_init_clock (adsp);if (ret) - goto free_rproc; + goto unassign_mem; ret =adsp_init_regulator (adsp);if (ret) - goto free_rproc; + goto unassign_mem; ret =adsp_pds_attach (&pdev->dev, adsp->proxy_pds, desc->proxy_pd_names);if (ret <0 ) - goto free_rproc; + goto unassign_mem; adsp->proxy_pd_count = ret; ret = qcom_q6v5_init(&adsp->q6v5, pdev, rproc, desc->crash_reason_smem, desc->load_state,
@@ -784,18 +784,28 @@ static int adsp_probe(struct platform_device *pdev) desc->ssctl_id);if (IS_ERR (adsp->sysmon)) { ret =PTR_ERR (adsp->sysmon); - goto detach_proxy_pds; + goto deinit_remove_pdm_smd_glink; }qcom_add_ssr_subdev (rproc, &adsp->ssr_subdev, desc->ssr_name); ret =rproc_add (rproc);if (ret) - goto detach_proxy_pds; + goto remove_ssr_sysmon;return 0 ; +remove_ssr_sysmon: +qcom_remove_ssr_subdev (rproc, &adsp->ssr_subdev); +qcom_remove_sysmon_subdev (adsp->sysmon); +deinit_remove_pdm_smd_glink: +qcom_remove_pdm_subdev (rproc, &adsp->pdm_subdev); +qcom_remove_smd_subdev (rproc, &adsp->smd_subdev); +qcom_remove_glink_subdev (rproc, &adsp->glink_subdev); +qcom_q6v5_deinit (&adsp->q6v5); detach_proxy_pds:adsp_pds_detach (adsp, adsp->proxy_pds, adsp->proxy_pd_count); +unassign_mem: +adsp_unassign_memory_region (adsp); free_rproc:device_init_wakeup (adsp->dev, false);
Signature · 1 line
2.34.1
PATCH v3 2/3 remoteproc: qcom: adsp: Remove subdevs on the error path of adsp_probe()
In reply to Joe HattoriCurrent implementation of adsp_probe() in qcom_q6v5_adsp.c and does not remove the subdevs of adsp on the error path. Fix this bug by calling qcom_remove_{ssr,sysmon,pdm,smd,glink}_subdev(), and qcom_q6v5_deinit() appropriately.
--- drivers/remoteproc/qcom_q6v5_adsp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/remoteproc/qcom_q6v5_adsp.c +9 -2
@@ -734,15 +734,22 @@ static int adsp_probe(struct platform_device *pdev) desc->ssctl_id);if (IS_ERR (adsp->sysmon)) { ret =PTR_ERR (adsp->sysmon); - goto disable_pm; + goto deinit_remove_glink_pdm_ssr; } ret =rproc_add (rproc);if (ret) - goto disable_pm; + goto remove_sysmon;return 0 ; +remove_sysmon: +qcom_remove_sysmon_subdev (adsp->sysmon); +deinit_remove_glink_pdm_ssr: +qcom_q6v5_deinit (&adsp->q6v5); +qcom_remove_glink_subdev (rproc, &adsp->glink_subdev); +qcom_remove_pdm_subdev (rproc, &adsp->pdm_subdev); +qcom_remove_ssr_subdev (rproc, &adsp->ssr_subdev); disable_pm:qcom_rproc_pds_detach (adsp);
Signature · 1 line
2.34.1
PATCH v3 3/3 remoteproc: qcom: wcss: Remove subdevs on the error path of q6v5_wcss_probe()
In reply to Joe HattoriCurrent implementation of q6v5_wcss_probe() in qcom_q6v5_wcss.c and does not remove the subdevs on the error path. Fix this bug by calling qcom_remove_{ssr,sysmon,pdm,glink}_subdev(), and qcom_q6v5_deinit() appropriately.
--- drivers/remoteproc/qcom_q6v5_wcss.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/remoteproc/qcom_q6v5_wcss.c +17 -2
@@ -1056,18 +1056,33 @@ static int q6v5_wcss_probe(struct platform_device *pdev)qcom_add_pdm_subdev (rproc, &wcss->pdm_subdev);qcom_add_ssr_subdev (rproc, &wcss->ssr_subdev,"q6wcss" ); -if (desc->ssctl_id) +if (desc->ssctl_id) { wcss->sysmon =qcom_add_sysmon_subdev (rproc, desc->sysmon_name, desc->ssctl_id); +if (IS_ERR (wcss->sysmon)) { + ret =PTR_ERR (wcss->sysmon); + goto deinit_remove_subdevs; + } + } ret =rproc_add (rproc);if (ret) -return ret; + goto remove_sysmon_subdev;platform_set_drvdata (pdev, rproc);return 0 ; + +remove_sysmon_subdev: +if (desc->ssctl_id) +qcom_remove_sysmon_subdev (wcss->sysmon); +deinit_remove_subdevs: +qcom_q6v5_deinit (&wcss->q6v5); +qcom_remove_glink_subdev (rproc, &wcss->glink_subdev); +qcom_remove_pdm_subdev (rproc, &wcss->pdm_subdev); +qcom_remove_ssr_subdev (rproc, &wcss->ssr_subdev); +return ret; }static void q6v5_wcss_remove (struct platform_device *pdev)
Signature · 1 line
2.34.1