Skip to content

Commit 283172b

Browse files
Anson-HuangShawn Guo
authored andcommitted
soc: imx8: Use existing of_root directly
There is common of_root for reference, no need to find it from DT again, use of_root directly to make driver simple. Signed-off-by: Anson Huang <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 1bcbe73 commit 283172b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/soc/imx/soc-imx8.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ static int __init imx8_soc_init(void)
9494
{
9595
struct soc_device_attribute *soc_dev_attr;
9696
struct soc_device *soc_dev;
97-
struct device_node *root;
9897
const struct of_device_id *id;
9998
u32 soc_rev = 0;
10099
const struct imx8_soc_data *data;
@@ -106,12 +105,11 @@ static int __init imx8_soc_init(void)
106105

107106
soc_dev_attr->family = "Freescale i.MX";
108107

109-
root = of_find_node_by_path("/");
110-
ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
108+
ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
111109
if (ret)
112110
goto free_soc;
113111

114-
id = of_match_node(imx8_soc_match, root);
112+
id = of_match_node(imx8_soc_match, of_root);
115113
if (!id) {
116114
ret = -ENODEV;
117115
goto free_soc;
@@ -136,16 +134,13 @@ static int __init imx8_soc_init(void)
136134
goto free_rev;
137135
}
138136

139-
of_node_put(root);
140-
141137
return 0;
142138

143139
free_rev:
144140
if (strcmp(soc_dev_attr->revision, "unknown"))
145141
kfree(soc_dev_attr->revision);
146142
free_soc:
147143
kfree(soc_dev_attr);
148-
of_node_put(root);
149144
return ret;
150145
}
151146
device_initcall(imx8_soc_init);

0 commit comments

Comments
 (0)