Skip to content

Instantly share code, notes, and snippets.

@dolcini
Created March 6, 2024 14:23
Show Gist options
  • Save dolcini/99bf8f7165305254204a7128cf4029de to your computer and use it in GitHub Desktop.
Save dolcini/99bf8f7165305254204a7128cf4029de to your computer and use it in GitHub Desktop.
cpsw-proxy-client compiler warning
GCC 13 reports the following warnings which seem to be valid.
Very likely one would want to check the content of 'is_valid', not the address where it is stored.
(introduced by commit 5f1b32f6bd1b ("net: ethernet: ti: cpsw-proxy-client: Switch to ATTACH Request"))
| CC [M] drivers/net/ethernet/ti/cpsw-proxy-client.o
|drivers/net/ethernet/ti/cpsw-proxy-client.c: In function 'cpsw_proxy_client_detach':
|drivers/net/ethernet/ti/cpsw-proxy-client.c:1753:29: warning: the comparison will always evaluate as 'true' for the address of 'virt_port_tx_chan' will never be NULL [-Waddress]
| 1753 | if (&virt_port->virt_port_tx_chan &&
| | ^
|drivers/net/ethernet/ti/cpsw-proxy-client.c:86:41: note: 'virt_port_tx_chan' declared here
| 86 | struct cpsw_proxy_tx_chan virt_port_tx_chan[CPSW_PROXY_CLIENT_MAX_TX_QUEUES];
| | ^~~~~~~~~~~~~~~~~
|drivers/net/ethernet/ti/cpsw-proxy-client.c:1753:59: warning: the comparison will always evaluate as 'true' for the address of 'is_valid' will never be NULL [-Waddress]
| 1753 | if (&virt_port->virt_port_tx_chan &&
&virt_port->virt_port_tx_chan->is_valid) {
| | ^~
|drivers/net/ethernet/ti/cpsw-proxy-client.c:60:41: note: 'is_valid' declared here
| 60 | bool is_valid;
| | ^~~~~~~~
|drivers/net/ethernet/ti/cpsw-proxy-client.c:1770:29: warning: the comparison will always evaluate as 'true' for the address of 'virt_port_rx_chan' will never be NULL [-Waddress]
| 1770 | if (&virt_port->virt_port_rx_chan &&
| | ^
|drivers/net/ethernet/ti/cpsw-proxy-client.c:87:41: note: 'virt_port_rx_chan' declared here
| 87 | struct cpsw_proxy_rx_chan virt_port_rx_chan[CPSW_PROXY_CLIENT_MAX_RX_QUEUES];
| | ^~~~~~~~~~~~~~~~~
|drivers/net/ethernet/ti/cpsw-proxy-client.c:1770:59: warning: the comparison will always evaluate as 'true' for the address of 'is_valid' will never be NULL [-Waddress]
| 1770 | if (&virt_port->virt_port_rx_chan &&
| | ^~
|drivers/net/ethernet/ti/cpsw-proxy-client.c:79:41: note: 'is_valid' declared here
| 79 | bool is_valid;
| | ^~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment