Skip to content

Commit 4c396a6

Browse files
Anson-HuangShawn Guo
authored andcommitted
soc: imx: soc-imx8: Correct return value of error handle
Current implementation of i.MX8 SoC driver returns -ENODEV for all cases of error during initialization, this is incorrect. This patch fixes them using correct return value according to different errors. Signed-off-by: Anson Huang <[email protected]> Reviewed-by: Leonard Crestez <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent d8dfab0 commit 4c396a6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/soc/imx/soc-imx8.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static int __init imx8_soc_init(void)
102102

103103
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
104104
if (!soc_dev_attr)
105-
return -ENODEV;
105+
return -ENOMEM;
106106

107107
soc_dev_attr->family = "Freescale i.MX";
108108

@@ -112,8 +112,10 @@ static int __init imx8_soc_init(void)
112112
goto free_soc;
113113

114114
id = of_match_node(imx8_soc_match, root);
115-
if (!id)
115+
if (!id) {
116+
ret = -ENODEV;
116117
goto free_soc;
118+
}
117119

118120
data = id->data;
119121
if (data) {
@@ -123,12 +125,16 @@ static int __init imx8_soc_init(void)
123125
}
124126

125127
soc_dev_attr->revision = imx8_revision(soc_rev);
126-
if (!soc_dev_attr->revision)
128+
if (!soc_dev_attr->revision) {
129+
ret = -ENOMEM;
127130
goto free_soc;
131+
}
128132

129133
soc_dev = soc_device_register(soc_dev_attr);
130-
if (IS_ERR(soc_dev))
134+
if (IS_ERR(soc_dev)) {
135+
ret = PTR_ERR(soc_dev);
131136
goto free_rev;
137+
}
132138

133139
of_node_put(root);
134140

@@ -139,6 +145,6 @@ static int __init imx8_soc_init(void)
139145
free_soc:
140146
kfree(soc_dev_attr);
141147
of_node_put(root);
142-
return -ENODEV;
148+
return ret;
143149
}
144150
device_initcall(imx8_soc_init);

0 commit comments

Comments
 (0)