Skip to content

Commit f41658c

Browse files
tititiou36andersson
authored andcommitted
bus: qcom-ssc-block-bus: Fix the error handling path of qcom_ssc_block_bus_probe()
If qcom_ssc_block_bus_pds_enable() fails, the previous call to qcom_ssc_block_bus_pds_attach() must be undone, as already done in the remove function. In order to do that, move the code related to the power domains management to the end of the function, in order to avoid many changes in all the error handling path that would need to go through the new error handling path. Fixes: 97d485e ("bus: add driver for initializing the SSC bus on (some) qcom SoCs") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/1b89ec7438c9a893c09083e8591772c8ad3cb599.1740932040.git.christophe.jaillet@wanadoo.fr Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent a9ac4ba commit f41658c

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

drivers/bus/qcom-ssc-block-bus.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,6 @@ static int qcom_ssc_block_bus_probe(struct platform_device *pdev)
264264

265265
platform_set_drvdata(pdev, data);
266266

267-
data->pd_names = qcom_ssc_block_pd_names;
268-
data->num_pds = ARRAY_SIZE(qcom_ssc_block_pd_names);
269-
270-
/* power domains */
271-
ret = qcom_ssc_block_bus_pds_attach(&pdev->dev, data->pds, data->pd_names, data->num_pds);
272-
if (ret < 0)
273-
return dev_err_probe(&pdev->dev, ret, "error when attaching power domains\n");
274-
275-
ret = qcom_ssc_block_bus_pds_enable(data->pds, data->num_pds);
276-
if (ret < 0)
277-
return dev_err_probe(&pdev->dev, ret, "error when enabling power domains\n");
278-
279267
/* low level overrides for when the HW logic doesn't "just work" */
280268
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpm_sscaon_config0");
281269
data->reg_mpm_sscaon_config0 = devm_ioremap_resource(&pdev->dev, res);
@@ -343,11 +331,30 @@ static int qcom_ssc_block_bus_probe(struct platform_device *pdev)
343331

344332
data->ssc_axi_halt = halt_args.args[0];
345333

334+
/* power domains */
335+
data->pd_names = qcom_ssc_block_pd_names;
336+
data->num_pds = ARRAY_SIZE(qcom_ssc_block_pd_names);
337+
338+
ret = qcom_ssc_block_bus_pds_attach(&pdev->dev, data->pds, data->pd_names, data->num_pds);
339+
if (ret < 0)
340+
return dev_err_probe(&pdev->dev, ret, "error when attaching power domains\n");
341+
342+
ret = qcom_ssc_block_bus_pds_enable(data->pds, data->num_pds);
343+
if (ret < 0) {
344+
dev_err_probe(&pdev->dev, ret, "error when enabling power domains\n");
345+
goto err_detach_pds_bus;
346+
}
347+
346348
qcom_ssc_block_bus_init(&pdev->dev);
347349

348350
of_platform_populate(np, NULL, NULL, &pdev->dev);
349351

350352
return 0;
353+
354+
err_detach_pds_bus:
355+
qcom_ssc_block_bus_pds_detach(&pdev->dev, data->pds, data->num_pds);
356+
357+
return ret;
351358
}
352359

353360
static void qcom_ssc_block_bus_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)