git: ahci: Remove redundant conditions to fix -Waddress warnings
Aaron LI
aly at crater.dragonflybsd.org
Tue Oct 13 23:15:09 PDT 2026
commit 43fdc1923f36f8d55b213c659e97fe15f020e4a5
Author: Aaron LI <aly at aaronly.me>
Date: Wed Oct 14 13:08:31 2026 +0800
ahci: Remove redundant conditions to fix -Waddress warnings
The 'ap_ata' field is a pointer array, so 'ap->ap_ata' represents the
address of the field, which is always not NULL. Remove the redundant
checks to fix the '-Waddress' warnings given by GCC 12.5:
```
/usr/src/sys/dev/disk/ahci/ahci.c: In function 'ahci_port_free':
/usr/src/sys/dev/disk/ahci/ahci.c:1029:13: warning: the comparison will always evaluate as 'true' for the address of 'ap_ata' will never be NULL [-Waddress]
1029 | if (ap->ap_ata) {
| ^~
In file included from /usr/src/sys/dev/disk/ahci/ahci.c:54:
/usr/src/sys/dev/disk/ahci/ahci.h:488:34: note: 'ap_ata' declared here
488 | struct ata_port *ap_ata[AHCI_MAX_PMPORTS];
| ^~~~~~
/usr/src/sys/dev/disk/ahci/ahci.c: In function 'ahci_port_hardstop':
/usr/src/sys/dev/disk/ahci/ahci.c:1831:21: warning: the comparison will always evaluate as 'true' for the address of 'ap_ata' will never be NULL [-Waddress]
1831 | for (i = 0; ap->ap_ata && i < AHCI_MAX_PMPORTS; ++i) {
| ^~
/usr/src/sys/dev/disk/ahci/ahci.h:488:34: note: 'ap_ata' declared here
488 | struct ata_port *ap_ata[AHCI_MAX_PMPORTS];
| ^~~~~~
```
Summary of changes:
sys/dev/disk/ahci/ahci.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/43fdc1923f36f8d55b213c659e97fe15f020e4a5
--
DragonFly BSD source repository
More information about the Commits
mailing list