提交 3d81216f 编写于 作者: A Alban Bedel 提交者: Philipp Zabel

reset: Fix of_reset_control_get() for consistent return values

When of_reset_control_get() is called without connection ID it returns
-ENOENT when the 'resets' property doesn't exists or is an empty entry.
However when a connection ID is given it returns -EINVAL when the 'resets'
property doesn't exists or the requested name can't be found. This is
because the error code returned by of_property_match_string() is just
passed down as an index to of_parse_phandle_with_args(), which then
returns -EINVAL.

To get a consistent return value with both code paths we must return
-ENOENT when of_property_match_string() fails.
Signed-off-by: NAlban Bedel <albeu@free.fr>
Signed-off-by: NPhilipp Zabel <p.zabel@pengutronix.de>
上级 c0a13aa6
...@@ -215,9 +215,12 @@ struct reset_control *of_reset_control_get(struct device_node *node, ...@@ -215,9 +215,12 @@ struct reset_control *of_reset_control_get(struct device_node *node,
{ {
int index = 0; int index = 0;
if (id) if (id) {
index = of_property_match_string(node, index = of_property_match_string(node,
"reset-names", id); "reset-names", id);
if (index < 0)
return ERR_PTR(-ENOENT);
}
return of_reset_control_get_by_index(node, index); return of_reset_control_get_by_index(node, index);
} }
EXPORT_SYMBOL_GPL(of_reset_control_get); EXPORT_SYMBOL_GPL(of_reset_control_get);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册