From 1202af2e7ed7fc768eac49e9b73866a96bd6926c Mon Sep 17 00:00:00 2001 From: Zhangfei Gao Date: Sat, 31 Dec 2022 11:38:13 +0000 Subject: [PATCH 01/28] wd: Fix GCC 12 build issue Build errors happen with GCC 12 wd.c: In function 'wd_is_isolate': wd.c:193:21: error: the comparison will always evaluate as 'true' for the address of 'dev_root' will never be NULL [-Werror=address] 193 | if (!dev || !dev->dev_root) | ^ In file included from wd.c:21: ./include/wd.h:131:14: note: 'dev_root' declared here 131 | char dev_root[PATH_STR_SIZE]; | ^~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:816: wd.lo] Error 1 Fix by using strlen(dev->dev_root). Signed-off-by: Thomas Monjalon Signed-off-by: Zhangfei Gao --- wd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wd.c b/wd.c index 629c0df..4f75113 100644 --- a/wd.c +++ b/wd.c @@ -190,7 +190,7 @@ int wd_is_isolate(struct uacce_dev *dev) int value = 0; int ret; - if (!dev || !dev->dev_root) + if (!dev || !strlen(dev->dev_root)) return -WD_EINVAL; ret = access_attr(dev->dev_root, "isolate", F_OK); -- 2.25.1