diff options
author | Michael Walle <michael@walle.cc> | 2022-04-04 11:56:07 +0200 |
---|---|---|
committer | Shawn Guo <shawnguo@kernel.org> | 2022-06-27 08:51:56 +0200 |
commit | b46dd0cb93decf58c43db0a39c1c047fc5315901 (patch) | |
tree | 7196ddd31a01d7d6c9d4404fc24bc117314ac155 | |
parent | soc: fsl: guts: allocate soc_dev_attr on the heap (diff) | |
download | linux-b46dd0cb93decf58c43db0a39c1c047fc5315901.tar.xz linux-b46dd0cb93decf58c43db0a39c1c047fc5315901.zip |
soc: fsl: guts: use of_root instead of own reference
There is already a global of_root reference. Use that instead of getting
one on our own. We don't need to care about the reference count either
this way.
Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
-rw-r--r-- | drivers/soc/fsl/guts.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 44e7a9bf6392..585cbd9d8224 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -112,7 +112,7 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match( static int fsl_guts_probe(struct platform_device *pdev) { - struct device_node *root, *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node; struct soc_device_attribute *soc_dev_attr; static struct soc_device *soc_dev; struct device *dev = &pdev->dev; @@ -138,17 +138,13 @@ static int fsl_guts_probe(struct platform_device *pdev) if (!soc_dev_attr) return -ENOMEM; - root = of_find_node_by_path("/"); - if (of_property_read_string(root, "model", &machine)) - of_property_read_string_index(root, "compatible", 0, &machine); + if (of_property_read_string(of_root, "model", &machine)) + of_property_read_string_index(of_root, "compatible", 0, &machine); if (machine) { soc_dev_attr->machine = devm_kstrdup(dev, machine, GFP_KERNEL); - if (!soc_dev_attr->machine) { - of_node_put(root); + if (!soc_dev_attr->machine) return -ENOMEM; - } } - of_node_put(root); soc_die = fsl_soc_die_match(svr, fsl_soc_die); if (soc_die) { |