From 7c327857016116eba1595c67c25d0314d1385e85 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Mon, 26 Apr 2010 10:49:10 +0200 Subject: [PATCH] Staging: iio: iio_trigger_find_by_name: Skip trailing newline if available Skip trailing newline if available. Signed-off-by: Michael Hennerich Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/industrialio-trigger.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c index 35ec80ba444f..3c8f6ffab584 100644 --- a/drivers/staging/iio/industrialio-trigger.c +++ b/drivers/staging/iio/industrialio-trigger.c @@ -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) { -- 2.39.5