Skip to content

Commit b08217a

Browse files
Laurentiu Palcuabelvesa
authored andcommitted
clk: imx95-blk-ctl: Fix synchronous abort
When enabling runtime PM for clock suppliers that also belong to a power domain, the following crash is thrown: error: synchronous external abort: 0000000096000010 [#1] PREEMPT SMP Workqueue: events_unbound deferred_probe_work_func pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : clk_mux_get_parent+0x60/0x90 lr : clk_core_reparent_orphans_nolock+0x58/0xd8 Call trace: clk_mux_get_parent+0x60/0x90 clk_core_reparent_orphans_nolock+0x58/0xd8 of_clk_add_hw_provider.part.0+0x90/0x100 of_clk_add_hw_provider+0x1c/0x38 imx95_bc_probe+0x2e0/0x3f0 platform_probe+0x70/0xd8 Enabling runtime PM without explicitly resuming the device caused the power domain cut off after clk_register() is called. As a result, a crash happens when the clock hardware provider is added and attempts to access the BLK_CTL register. Fix this by using devm_pm_runtime_enable() instead of pm_runtime_enable() and getting rid of the pm_runtime_disable() in the cleanup path. Fixes: 5224b18 ("clk: imx: add i.MX95 BLK CTL clk driver") Reviewed-by: Frank Li <[email protected]> Reviewed-by: Abel Vesa <[email protected]> Signed-off-by: Laurentiu Palcu <[email protected]> Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abel Vesa <[email protected]>
1 parent 0b0cd18 commit b08217a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/clk/imx/clk-imx95-blk-ctl.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,10 @@ static int imx95_bc_probe(struct platform_device *pdev)
342342
if (!clk_hw_data)
343343
return -ENOMEM;
344344

345-
if (bc_data->rpm_enabled)
346-
pm_runtime_enable(&pdev->dev);
345+
if (bc_data->rpm_enabled) {
346+
devm_pm_runtime_enable(&pdev->dev);
347+
pm_runtime_resume_and_get(&pdev->dev);
348+
}
347349

348350
clk_hw_data->num = bc_data->num_clks;
349351
hws = clk_hw_data->hws;
@@ -383,8 +385,10 @@ static int imx95_bc_probe(struct platform_device *pdev)
383385
goto cleanup;
384386
}
385387

386-
if (pm_runtime_enabled(bc->dev))
388+
if (pm_runtime_enabled(bc->dev)) {
389+
pm_runtime_put_sync(&pdev->dev);
387390
clk_disable_unprepare(bc->clk_apb);
391+
}
388392

389393
return 0;
390394

@@ -395,9 +399,6 @@ static int imx95_bc_probe(struct platform_device *pdev)
395399
clk_hw_unregister(hws[i]);
396400
}
397401

398-
if (bc_data->rpm_enabled)
399-
pm_runtime_disable(&pdev->dev);
400-
401402
return ret;
402403
}
403404

0 commit comments

Comments
 (0)