]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pmdomain: mediatek: Add error messages for missing regmaps
authorChen-Yu Tsai <wenst@chromium.org>
Mon, 21 Apr 2025 09:09:50 +0000 (17:09 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 25 Apr 2025 10:17:55 +0000 (12:17 +0200)
A recent change to the syscon regmap API caused the MediaTek power
controller drivers to fail, as the required regmap could no longer be
retrieved. The error did not have an accompanying message, making the
failure less obvious. The aforementioned change has since been reverted.

Add error messages to all the regmap retrievals, thereby making all
error paths in scpsys_add_one_domain() have visible error messages.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20250421090951.395467-1-wenst@chromium.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/mediatek/mtk-pm-domains.c

index 9a33321d9fac033df97604f280a06aa0f267092e..a58ed7e2d9a4798c04d7888ebd6a85f7ff839d27 100644 (file)
@@ -398,20 +398,26 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
 
        pd->infracfg = syscon_regmap_lookup_by_phandle_optional(node, "mediatek,infracfg");
        if (IS_ERR(pd->infracfg))
-               return ERR_CAST(pd->infracfg);
+               return dev_err_cast_probe(scpsys->dev, pd->infracfg,
+                                         "%pOF: failed to get infracfg regmap\n",
+                                         node);
 
        smi_node = of_parse_phandle(node, "mediatek,smi", 0);
        if (smi_node) {
                pd->smi = device_node_to_regmap(smi_node);
                of_node_put(smi_node);
                if (IS_ERR(pd->smi))
-                       return ERR_CAST(pd->smi);
+                       return dev_err_cast_probe(scpsys->dev, pd->smi,
+                                                 "%pOF: failed to get SMI regmap\n",
+                                                 node);
        }
 
        if (MTK_SCPD_CAPS(pd, MTK_SCPD_HAS_INFRA_NAO)) {
                pd->infracfg_nao = syscon_regmap_lookup_by_phandle(node, "mediatek,infracfg-nao");
                if (IS_ERR(pd->infracfg_nao))
-                       return ERR_CAST(pd->infracfg_nao);
+                       return dev_err_cast_probe(scpsys->dev, pd->infracfg_nao,
+                                                 "%pOF: failed to get infracfg-nao regmap\n",
+                                                 node);
        } else {
                pd->infracfg_nao = NULL;
        }