compilation failure with GCC 12
Closed this issue · 1 comments
tmonjalo commented
GCC 12 emits this error:
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];
| ^~~~~~~~
dev_root being an initialized array, it cannot be NULL.
It should be fixed with this patch:
--- 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)
return -WD_EINVAL;
ret = access_attr(dev->dev_root, "isolate", F_OK);
gaozhangfei commented
Thanks, Thomas