Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752318Ab0DZIxv (ORCPT ); Mon, 26 Apr 2010 04:53:51 -0400 Received: from nwd2mail11.analog.com ([137.71.25.57]:28517 "EHLO nwd2mail11.analog.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010Ab0DZIxt (ORCPT ); Mon, 26 Apr 2010 04:53:49 -0400 X-IronPort-AV: E=Sophos;i="4.52,272,1270440000"; d="scan'208";a="15856955" From: To: gregkh@suse.de CC: jic23@cam.ac.uk, uclinux-dist-devel@blackfin.uclinux.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Michael Hennerich Subject: [PATCH] iio_trigger_find_by_name: Skip trailing newline if available Date: Mon, 26 Apr 2010 10:49:10 +0200 Message-ID: <1272271750-6182-1-git-send-email-michael.hennerich@analog.com> X-Mailer: git-send-email 1.6.0.2 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1061 Lines: 27 Skip trailing newline if available. Signed-off-by: Michael Hennerich Acked-by: Jonathan Cameron drivers/staging/iio/industrialio-trigger.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c index 693ebc4..5f76fc1 100644 --- a/drivers/staging/iio/industrialio-trigger.c +++ b/drivers/staging/iio/industrialio-trigger.c @@ -155,6 +155,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) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/