Skip to content

Commit 60e7c43

Browse files
joehattoriandersson
authored andcommitted
remoteproc: qcom: wcss: Remove subdevs on the error path of q6v5_wcss_probe()
Current 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. Signed-off-by: Joe Hattori <[email protected]> Link: https://lore.kernel.org/r/c4437393bfaeda69351157849b5e0a904586b1c2.1731038950.git.joe@pf.is.s.u-tokyo.ac.jp Signed-off-by: Bjorn Andersson <[email protected]>
1 parent fe80d32 commit 60e7c43

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

drivers/remoteproc/qcom_q6v5_wcss.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,18 +1056,33 @@ static int q6v5_wcss_probe(struct platform_device *pdev)
10561056
qcom_add_pdm_subdev(rproc, &wcss->pdm_subdev);
10571057
qcom_add_ssr_subdev(rproc, &wcss->ssr_subdev, "q6wcss");
10581058

1059-
if (desc->ssctl_id)
1059+
if (desc->ssctl_id) {
10601060
wcss->sysmon = qcom_add_sysmon_subdev(rproc,
10611061
desc->sysmon_name,
10621062
desc->ssctl_id);
1063+
if (IS_ERR(wcss->sysmon)) {
1064+
ret = PTR_ERR(wcss->sysmon);
1065+
goto deinit_remove_subdevs;
1066+
}
1067+
}
10631068

10641069
ret = rproc_add(rproc);
10651070
if (ret)
1066-
return ret;
1071+
goto remove_sysmon_subdev;
10671072

10681073
platform_set_drvdata(pdev, rproc);
10691074

10701075
return 0;
1076+
1077+
remove_sysmon_subdev:
1078+
if (desc->ssctl_id)
1079+
qcom_remove_sysmon_subdev(wcss->sysmon);
1080+
deinit_remove_subdevs:
1081+
qcom_q6v5_deinit(&wcss->q6v5);
1082+
qcom_remove_glink_subdev(rproc, &wcss->glink_subdev);
1083+
qcom_remove_pdm_subdev(rproc, &wcss->pdm_subdev);
1084+
qcom_remove_ssr_subdev(rproc, &wcss->ssr_subdev);
1085+
return ret;
10711086
}
10721087

10731088
static void q6v5_wcss_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)