[dm-devel] [PATCH 1/6] checker: remove useless name check in checker_get func

Zhiqiang Liu liuzhiqiang26 at huawei.com
Sun Aug 16 01:42:05 UTC 2020


In checker_get func, input name will be checked before
calling checker_class_lookup func, in which name will
also be checked.

Here, we just remove useless input name check in checker_get func.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26 at huawei.com>
Signed-off-by: lixiaokeng <lixiaokeng at huawei.com>
---
 libmultipath/checkers.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index f7ddd53..ac41d64 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -361,11 +361,10 @@ void checker_get(const char *multipath_dir, struct checker *dst,
 	if (!dst)
 		return;

-	if (name && strlen(name)) {
-		src = checker_class_lookup(name);
-		if (!src)
-			src = add_checker_class(multipath_dir, name);
-	}
+	src = checker_class_lookup(name);
+	if (!src)
+		src = add_checker_class(multipath_dir, name);
+
 	dst->cls = src;
 	if (!src)
 		return;
-- 
1.8.3.1






More information about the dm-devel mailing list