Commit a7c1d0a9 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Torvalds

device property: convert to use match_string() helper

The new helper returns index of the mathing string in an array.  We
would use it here.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 56b06081
...@@ -651,7 +651,7 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode, ...@@ -651,7 +651,7 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode,
const char *propname, const char *string) const char *propname, const char *string)
{ {
const char **values; const char **values;
int nval, ret, i; int nval, ret;
nval = fwnode_property_read_string_array(fwnode, propname, NULL, 0); nval = fwnode_property_read_string_array(fwnode, propname, NULL, 0);
if (nval < 0) if (nval < 0)
...@@ -668,13 +668,9 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode, ...@@ -668,13 +668,9 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode,
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = match_string(values, nval, string);
if (ret < 0)
ret = -ENODATA; ret = -ENODATA;
for (i = 0; i < nval; i++) {
if (!strcmp(values[i], string)) {
ret = i;
break;
}
}
out: out:
kfree(values); kfree(values);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment