mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
Staging: iio: iio_trigger_find_by_name: Skip trailing newline if available
Skip trailing newline if available. Signed-off-by: Michael Hennerich <Michael.Hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a05d7ce36c
commit
7c32785701
1 changed files with 3 additions and 0 deletions
|
@ -156,6 +156,9 @@ struct iio_trigger *iio_trigger_find_by_name(const char *name, size_t len)
|
|||
struct iio_trigger *trig;
|
||||
bool found = false;
|
||||
|
||||
if (len && name[len - 1] == '\n')
|
||||
len--;
|
||||
|
||||
mutex_lock(&iio_trigger_list_lock);
|
||||
list_for_each_entry(trig, &iio_trigger_list, list) {
|
||||
if (strncmp(trig->name, name, len) == 0) {
|
||||
|
|
Loading…
Reference in a new issue