• Bjorn Helgaas's avatar
    net/mlx4: Avoid 'may be used uninitialized' warnings · c1c52db1
    Bjorn Helgaas authored
    With a cross-compiler based on gcc-4.9, I see warnings like the following:
    
      drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_CQ_wrapper':
      drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:3048:10: error: 'cq' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        cq->mtt = mtt;
    
    I think the warning is spurious because we only use cq when
    cq_res_start_move_to() returns zero, and it always initializes *cq in that
    case.  The srq case is similar.  But maybe gcc isn't smart enough to figure
    that out.
    
    Initialize cq and srq explicitly to avoid the warnings.
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c1c52db1
resource_tracker.c 121 KB