LKML Archive on
 help / color / Atom feed
From: Serge Semin <>
To: Arnd Bergmann <>
Cc: Serge Semin <>,
	Serge Semin <>,
	Alexey Malahov <>,
	Olof Johansson <>,
	Andy Shevchenko <>,
	<>, <>
Subject: [PATCH 6/6] bus: bt1-axi: Use sysfs_streq instead of strncmp
Date: Thu, 28 May 2020 17:50:50 +0300
Message-ID: <> (raw)
In-Reply-To: <>

There is a ready-to-use method to compare a retrieved from a sysfs node
string with another string. It treats both NUL and newline-then-NUL as
equivalent string terminations. So use it instead of manually truncating
the line length in the strncmp() method.

Signed-off-by: Serge Semin <>
Cc: Alexey Malahov <>
Cc: Olof Johansson <>
Cc: Andy Shevchenko <>
 drivers/bus/bt1-axi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c
index c194d9a2bbeb..e7a6744acc7b 100644
--- a/drivers/bus/bt1-axi.c
+++ b/drivers/bus/bt1-axi.c
@@ -220,9 +220,9 @@ static ssize_t inject_error_store(struct device *dev,
 	 * error while unaligned writing - the AXI bus write error handled
 	 * by this driver.
-	if (!strncmp(data, "bus", 3))
+	if (sysfs_streq(data, "bus"))
-	else if (!strncmp(data, "unaligned", 9))
+	else if (sysfs_streq(data, "unaligned"))
 		writeb(0, axi->qos_regs);
 		return -EINVAL;

      parent reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 14:50 [PATCH 1/6] bus: bt1-apb: Include linux/io.h Serge Semin
2020-05-28 14:50 ` [PATCH 2/6] bus: bt1-apb: Fix show/store callback identations Serge Semin
2020-05-28 14:50 ` [PATCH 3/6] bus: bt1-apb: Use PTR_ERR_OR_ZERO to return from request-regs method Serge Semin
2020-05-28 14:50 ` [PATCH 4/6] bus: bt1-apb: Use sysfs_streq instead of strncmp Serge Semin
2020-05-28 14:50 ` [PATCH 5/6] bus: bt1-axi: Optimize the return points in the driver Serge Semin
2020-05-28 14:50 ` Serge Semin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git
	git clone --mirror lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone