Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation failure with GCC 12 #539

Closed
tmonjalo opened this issue Dec 30, 2022 · 1 comment
Closed

compilation failure with GCC 12 #539

tmonjalo opened this issue Dec 30, 2022 · 1 comment

Comments

@tmonjalo
Copy link

tmonjalo commented Dec 30, 2022

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
Copy link
Collaborator

Thanks, Thomas

#540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants