summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBinbin Zhou <zhoubinbin@loongson.cn>2026-10-24 15:55:50 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-10-24 15:55:50 +0800
commitecb531544804101cb6ca0b124b5a446ee2db2f9f (patch)
tree9b53c6284b0f8d0813cd5370c51513d3f8f535b4
parent1c3ac5b49de719c68036935f5da6494478a4ed6c (diff)
downloadlinux-next-ecb531544804101cb6ca0b124b5a446ee2db2f9f.tar.gz
linux-next-ecb531544804101cb6ca0b124b5a446ee2db2f9f.zip
soc: loongson: loongson2_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: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
-rw-r--r--drivers/soc/loongson/loongson2_guts.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c
index 16913c3ef65c..a2f2c1e119fe 100644
--- a/drivers/soc/loongson/loongson2_guts.c
+++ b/drivers/soc/loongson/loongson2_guts.c
@@ -92,8 +92,8 @@ static u32 loongson2_guts_get_svr(void)
static int loongson2_guts_probe(struct platform_device *pdev)
{
- struct device_node *root, *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
+ struct device_node *np = pdev->dev.of_node;
const struct loongson2_soc_die_attr *soc_die;
const char *machine;
u32 svr;
@@ -109,11 +109,8 @@ static int loongson2_guts_probe(struct platform_device *pdev)
if (IS_ERR(guts->regs))
return PTR_ERR(guts->regs);
- /* Register soc device */
- root = of_find_node_by_path("/");
- if (of_property_read_string(root, "model", &machine))
- of_property_read_string_index(root, "compatible", 0, &machine);
- of_node_put(root);
+ 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)