git: if_ti: Fix -Waddress warnings from GCC 12.5

Aaron LI aly at crater.dragonflybsd.org
Tue Oct 13 04:50:40 PDT 2026


commit 59604bf66b98c76a2e499eaa1f8763ee18a7afa5
Author: Aaron LI <aly at aaronly.me>
Date:   Tue Oct 13 09:52:28 2026 +0800

    if_ti: Fix -Waddress warnings from GCC 12.5
    
    The 'ti_event_ring' and 'ti_tx_ring' are embedded arrays in
    'struct ti_ring_data', so the checks were meaningless.  In addition, the
    'sc->ti_rdata' area is initialized in ti_attach(); it's always not
    NULL after a successful attach.  So just remove the checks to fix the
    following warnings from GCC 12.5:
    
    ```
    /usr/src/sys/dev/netif/ti/if_ti.c: In function 'ti_handle_events':
    /usr/src/sys/dev/netif/ti/if_ti.c:508:41: warning: the comparison will always evaluate as 'false' for the address of 'ti_event_ring' will never be NULL [-Waddress]
      508 |         if (sc->ti_rdata->ti_event_ring == NULL)
          |                                         ^~
    In file included from /usr/src/sys/dev/netif/ti/if_ti.c:116:
    /usr/src/sys/dev/netif/ti/if_tireg.h:1076:33: note: 'ti_event_ring' declared here
     1076 |         struct ti_event_desc    ti_event_ring[TI_EVENT_RING_CNT];
          |                                 ^~~~~~~~~~~~~
    /usr/src/sys/dev/netif/ti/if_ti.c: In function 'ti_free_tx_ring':
    /usr/src/sys/dev/netif/ti/if_ti.c:923:38: warning: the comparison will always evaluate as 'false' for the address of 'ti_tx_ring' will never be NULL [-Waddress]
      923 |         if (sc->ti_rdata->ti_tx_ring == NULL)
          |                                      ^~
    /usr/src/sys/dev/netif/ti/if_tireg.h:1077:33: note: 'ti_tx_ring' declared here
     1077 |         struct ti_tx_desc       ti_tx_ring[TI_TX_RING_CNT];
          |                                 ^~~~~~~~~~
    ```
    
    By the way, FreeBSD overhauled the DMA/ring code (see commit
    b7c2632d6af08a5dc053adc201f997667815e0ee), so a better fix would be sync
    the driver with FreeBSD.

Summary of changes:
 sys/dev/netif/ti/if_ti.c | 6 ------
 1 file changed, 6 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/59604bf66b98c76a2e499eaa1f8763ee18a7afa5


-- 
DragonFly BSD source repository


More information about the Commits mailing list