lib-string-introduce-match_string-helper fix
Andy Shevchenko
reviewerPATCH 1/2 lib-string-introduce-match_string-helper fix
Fix return code to be -EINVAL instead of -ENODATA.
Signed-off-by Andy Shevchenko <[email protected]>
--- lib/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/string.c +2 -2
@@ -637,7 +637,7 @@ EXPORT_SYMBOL(sysfs_streq);* @string: string to match with * * Return: -* index of a @string in the @array if matches, or %-ENODATA otherwise. +* index of a @string in the @array if matches, or %-EINVAL otherwise. */ int match_string (const char *const *array,size_t n,const char *string) {
@@ -652,7 +652,7 @@ int match_string(const char * const *array, size_t n, const char *string)return index; } -return -ENODATA ; +return -EINVAL ; }EXPORT_SYMBOL (match_string);
Signature · 1 line
2.7.0
Andy Shevchenko
reviewerPATCH 2/2 device-property-convert-to-use-match_string-helper fix
Since match_string() returns -EINVAL let's convert it to -ENODATA as designed by device property API.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/base/property.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/property.c +2 -0
@@ -665,6 +665,8 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode, goto out; ret =match_string (values, nval, string); +if (ret <0 ) + ret = -ENODATA ; out:kfree (values);return ret;
Signature · 1 line
2.7.0