Staging: iio: iio_trigger_find_by_name: Skip trailing newline if available
authorMichael Hennerich <Michael.Hennerich@analog.com>
Mon, 26 Apr 2010 08:49:10 +0000 (10:49 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 11 May 2010 18:35:46 +0000 (11:35 -0700)
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>
drivers/staging/iio/industrialio-trigger.c

index 35ec80ba444fc09c266c6e1a93b2ecce34e84a50..3c8f6ffab584b563e4cc0b25f8b0e2108fa461c7 100644 (file)
@@ -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) {