Skip to content

Commit aacb0a6

Browse files
committed
Merge tag 'pmdomain-v6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm
Pull pmdomain fixes from Ulf Hansson: - mediatek: Fix spinlock recursion fix during probe - imx: Fix reference count leak during probe * tag 'pmdomain-v6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm: pmdomain: imx: Fix reference count leak in imx_gpc_probe() pmdomain: mtk-pm-domains: Fix spinlock recursion fix in probe
2 parents 805f9a0 + 73cb5f6 commit aacb0a6

2 files changed

Lines changed: 8 additions & 18 deletions

File tree

drivers/pmdomain/imx/gpc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,12 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap,
402402
static int imx_gpc_probe(struct platform_device *pdev)
403403
{
404404
const struct imx_gpc_dt_data *of_id_data = device_get_match_data(&pdev->dev);
405-
struct device_node *pgc_node;
405+
struct device_node *pgc_node __free(device_node)
406+
= of_get_child_by_name(pdev->dev.of_node, "pgc");
406407
struct regmap *regmap;
407408
void __iomem *base;
408409
int ret;
409410

410-
pgc_node = of_get_child_by_name(pdev->dev.of_node, "pgc");
411-
412411
/* bail out if DT too old and doesn't provide the necessary info */
413412
if (!of_property_present(pdev->dev.of_node, "#power-domain-cells") &&
414413
!pgc_node)

drivers/pmdomain/mediatek/mtk-pm-domains.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -984,18 +984,6 @@ static void scpsys_domain_cleanup(struct scpsys *scpsys)
984984
}
985985
}
986986

987-
static struct device_node *scpsys_get_legacy_regmap(struct device_node *np, const char *pn)
988-
{
989-
struct device_node *local_node;
990-
991-
for_each_child_of_node(np, local_node) {
992-
if (of_property_present(local_node, pn))
993-
return local_node;
994-
}
995-
996-
return NULL;
997-
}
998-
999987
static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *scpsys)
1000988
{
1001989
const u8 bp_blocks[3] = {
@@ -1017,7 +1005,8 @@ static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *s
10171005
* this makes it then possible to allocate the array of bus_prot
10181006
* regmaps and convert all to the new style handling.
10191007
*/
1020-
node = scpsys_get_legacy_regmap(np, "mediatek,infracfg");
1008+
of_node_get(np);
1009+
node = of_find_node_with_property(np, "mediatek,infracfg");
10211010
if (node) {
10221011
regmap[0] = syscon_regmap_lookup_by_phandle(node, "mediatek,infracfg");
10231012
of_node_put(node);
@@ -1030,7 +1019,8 @@ static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *s
10301019
regmap[0] = NULL;
10311020
}
10321021

1033-
node = scpsys_get_legacy_regmap(np, "mediatek,smi");
1022+
of_node_get(np);
1023+
node = of_find_node_with_property(np, "mediatek,smi");
10341024
if (node) {
10351025
smi_np = of_parse_phandle(node, "mediatek,smi", 0);
10361026
of_node_put(node);
@@ -1048,7 +1038,8 @@ static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *s
10481038
regmap[1] = NULL;
10491039
}
10501040

1051-
node = scpsys_get_legacy_regmap(np, "mediatek,infracfg-nao");
1041+
of_node_get(np);
1042+
node = of_find_node_with_property(np, "mediatek,infracfg-nao");
10521043
if (node) {
10531044
regmap[2] = syscon_regmap_lookup_by_phandle(node, "mediatek,infracfg-nao");
10541045
num_regmaps++;

0 commit comments

Comments
 (0)