Skip to content

Commit

Permalink
eth: linkdata: sxevf: Return -ENOMEM when l_xdp_rxq_reg_failed
Browse files Browse the repository at this point in the history
Fix follow error with clang-19:

drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:73:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
   73 |         if (xdp_rxq_info_reg(&ring->xdp_rxq, adapter->netdev, ring->idx, 0) < 0) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:96:9: note: uninitialized use occurs here
   96 |         return ret;
      |                ^~~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:73:2: note: remove the 'if' if its condition is always false
   73 |         if (xdp_rxq_info_reg(&ring->xdp_rxq, adapter->netdev, ring->idx, 0) < 0) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   74 |                 LOG_ERROR_BDF("ring[%u] xdp rxq info reg failed\n",ring->idx);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   75 |                 goto l_xdp_rxq_reg_failed;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
   76 |         }
      |         ~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:35:9: note: initialize the variable 'ret' to silence this warning
   35 |         s32 ret;
      |                ^
      |                 = 0
1 error generated.

Signed-off-by: WangYuli <[email protected]>
  • Loading branch information
Avenger-285714 committed Nov 25, 2024
1 parent 6fd3262 commit c34586d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static inline int xdp_rxq_info_reg_compat(struct xdp_rxq_info *xdp_rxq,

static s32 sxevf_rx_ring_alloc(struct sxevf_ring *ring)
{
s32 ret;
s32 ret = 0;
u32 size;
union sxevf_rx_data_desc *desc;
struct sxevf_adapter *adapter = netdev_priv(ring->netdev);
Expand Down Expand Up @@ -72,13 +72,14 @@ static s32 sxevf_rx_ring_alloc(struct sxevf_ring *ring)
#ifndef HAVE_NO_XDP_BUFF_RXQ
if (xdp_rxq_info_reg(&ring->xdp_rxq, adapter->netdev, ring->idx, 0) < 0) {
LOG_ERROR_BDF("ring[%u] xdp rxq info reg failed\n",ring->idx);
ret = -ENOMEM;
goto l_xdp_rxq_reg_failed;
}
#endif

ring->xdp_prog = adapter->xdp_prog;

return 0;
return ret;

#ifndef HAVE_NO_XDP_BUFF_RXQ
l_xdp_rxq_reg_failed:
Expand Down

0 comments on commit c34586d

Please sign in to comment.