qlcnic: fix a return in qlcnic_dcb_get_capability()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 19 Oct 2018 20:11:11 +0000 (23:11 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Oct 2018 02:34:16 +0000 (19:34 -0700)
These functions are supposed to return one on failure and zero on
success.  Returning a zero here could cause uninitialized variable
bugs in several of the callers.  For example:

    drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1660 get_iscsi_dcb_priority()
    error: uninitialized symbol 'caps'.

Fixes: 48365e485275 ("qlcnic: dcb: Add support for CEE Netlink interface.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c

index 4b76c69fe86d2aaa8609456277b767f1993bffe4..834208e55f7b8a7d1e2ac535096e64b263505178 100644 (file)
@@ -883,7 +883,7 @@ static u8 qlcnic_dcb_get_capability(struct net_device *netdev, int capid,
        struct qlcnic_adapter *adapter = netdev_priv(netdev);
 
        if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
        struct qlcnic_adapter *adapter = netdev_priv(netdev);
 
        if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
-               return 0;
+               return 1;
 
        switch (capid) {
        case DCB_CAP_ATTR_PG:
 
        switch (capid) {
        case DCB_CAP_ATTR_PG: