summaryrefslogtreecommitdiffstats
path: root/drivers/reset
diff options
context:
space:
mode:
authorAlban Bedel <albeu@free.fr>2015-09-01 11:28:31 -0400
committerPhilipp Zabel <p.zabel@pengutronix.de>2015-11-16 03:23:47 -0500
commit3d81216fde465e76c5eae98f61d3666163634395 (patch)
tree023f1529f76097af8c143587979744fea38e393d /drivers/reset
parentc0a13aa6da5da19f9eedb562b226ec585aabdca9 (diff)
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: Alban Bedel <albeu@free.fr> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 81ae17d15480..77cfc49218c6 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -215,9 +215,12 @@ struct reset_control *of_reset_control_get(struct device_node *node,
215{ 215{
216 int index = 0; 216 int index = 0;
217 217
218 if (id) 218 if (id) {
219 index = of_property_match_string(node, 219 index = of_property_match_string(node,
220 "reset-names", id); 220 "reset-names", id);
221 if (index < 0)
222 return ERR_PTR(-ENOENT);
223 }
221 return of_reset_control_get_by_index(node, index); 224 return of_reset_control_get_by_index(node, index);
222} 225}
223EXPORT_SYMBOL_GPL(of_reset_control_get); 226EXPORT_SYMBOL_GPL(of_reset_control_get);