Commit 7c327857 authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman

Staging: iio: iio_trigger_find_by_name: Skip trailing newline if available

Skip trailing newline if available.
Signed-off-by: default avatarMichael Hennerich <Michael.Hennerich@analog.com>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a05d7ce3
...@@ -156,6 +156,9 @@ struct iio_trigger *iio_trigger_find_by_name(const char *name, size_t len) ...@@ -156,6 +156,9 @@ struct iio_trigger *iio_trigger_find_by_name(const char *name, size_t len)
struct iio_trigger *trig; struct iio_trigger *trig;
bool found = false; bool found = false;
if (len && name[len - 1] == '\n')
len--;
mutex_lock(&iio_trigger_list_lock); mutex_lock(&iio_trigger_list_lock);
list_for_each_entry(trig, &iio_trigger_list, list) { list_for_each_entry(trig, &iio_trigger_list, list) {
if (strncmp(trig->name, name, len) == 0) { if (strncmp(trig->name, name, len) == 0) {
......
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