scsi: target: Use sysfs_streq() instead of strncmp()
Subsystems (2)
PATCH 1/1 scsi: target: Use sysfs_streq() instead of strncmp()
From: Xu Panda <[email protected]>
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 Xu Panda <[email protected]>
Signed-off-by Yang Yang <[email protected]>
--- drivers/target/target_core_configfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/target/target_core_configfs.c +2 -2
@@ -208,7 +208,7 @@ static struct config_group *target_core_register_fabric(* mkdir(2) system calls with known TCM fabric modules. */ -if (!strncmp (name,"iscsi" ,5 )) { +if (!sysfs_streq (name,"iscsi" )) {/* * Automatically load the LIO Target fabric module when the * following is called:
@@ -221,7 +221,7 @@ static struct config_group *target_core_register_fabric( " iscsi_target_mod.ko: %d\n", ret);return ERR_PTR (-EINVAL ); } - }else if (!strncmp (name,"loopback" ,8 )) { + }else if (!sysfs_streq (name,"loopback" )) {/* * Automatically load the tcm_loop fabric module when the * following is called:
Signature · 1 line
2.15.2