Skip to contentSkip to conversation

pmdomain: mediatek: mfg: Handle MT8196 EB clock enable errors

PATCH In review Jiawen Liu 2 participants 2 messages Nov 29 – Nov 30

Subsystems (2)
lore
Share & tools
lore

Jiawen Liu

author
#0 lore raw

PATCH 1/1 pmdomain: mediatek: mfg: Handle MT8196 EB clock enable errors

The MT8196 variant can fail to prepare the EB clock if its provider is removed after lookup and no managed device link serializes removal with probe. mtk_mfg_mt8196_init() ignores the error and reads the revision register without acquiring a clock reference. If the read returns, the unmatched release can trigger the clock framework's already-disabled and already-unprepared warnings when the respective counts are zero. Variant initialization then reports success.

Return the clock error before reading the revision register. The existing dev_err_probe() path reports and propagates the error. After a successful clock enable, release the temporary clock reference after the read.

Static review verified the error
and success paths, and the driver object built with arm64 defconfig. git diff --check and checkpatch.pl passed. Runtime and hardware reproduction were not performed.

Fixes f08e7a4e8d6a ("pmdomain: mediatek: Add support for MFlexGraphics")
---
 drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c +4 -1
index 093f8fac2a2cd..a52e71b3912af 100644
@@ -597,13 +597,16 @@ static const char *const mtk_mfg_mt8196_regulators[] = {
 static int mtk_mfg_mt8196_init(struct mtk_mfg *mfg)
 {
 	void __iomem *e2_base;
+	int ret;
 
 	e2_base = devm_platform_ioremap_resource_byname(mfg->pdev, "hw-revision");
 	if (IS_ERR(e2_base))
 		return dev_err_probe(&mfg->pdev->dev, PTR_ERR(e2_base),
 				     "Couldn't get hw-revision register\n");
 
-	clk_prepare_enable(mfg->clk_eb);
+	ret = clk_prepare_enable(mfg->clk_eb);
+	if (ret)
+		return ret;
 
 	if (readl(e2_base) == MFG_MT8196_E2_ID)
 		mfg->ghpm_en_reg = RPC_DUMMY_REG_2;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 18 lines · Jiawen Liu

The MT8196 variant can fail to prepare the EB clock if its provider is removed after lookup and no managed device link serializes removal with probe. mtk_mfg_mt8196_init() ignores the error and reads the revision register without acquiring a clock reference. If the read returns, the unmatched release can trigger the clock framework's already-disabled and already-unprepared warnings when the respective counts are zero. Variant initialization then reports success.

Return the clock error before reading the revision register. The existing dev_err_probe() path reports and propagates the error. After a successful clock enable, release the temporary clock reference after the read.

Static review verified the error
and success paths, and the driver object built with arm64 defconfig. git diff --check and checkpatch.pl passed. Runtime and hardware reproduction were not performed.

Quoted 6 lines
Fixes f08e7a4e8d6a ("pmdomain: mediatek: Add support for MFlexGraphics")
---
 drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

You sent multiple independent patches, to multiple independent subsystems. The amount of these patches clearly suggest this was AI generated and most likely not tested.

More importantly, you sent all this work without properly organizing relevant patches into patchsets. This makes reviewing difficult and might cause multiple reviewers to address the same issue. Replying to the entire set is impossible and requires handling each patch independently, instead of applying or discarding the set. Maintainers also won't see the bigger picture of your work. Quite worrying.

Please read kernel documentation BEFORE posting more work. It will explain you how to identify subsystems, how to organize your work per subsystem (so a patchset grouping multiple patches with a short cover letter), how to document the issue discovery method and what was or was not tested.

Best regards,
Krzysztof