Skip to content

Commit 2b88f2d

Browse files
John FastabendJeff Kirsher
authored andcommitted
net: dcb: getnumtcs()/setnumtcs() should return an int
{g|s}etnumtcs() today returns a u8 that is only used by the DCB code to verify no error occurred. Today the driver implementations return negative error codes which end up being non-zero so the logic works out but triggers some sparse warnings. To fix the sparse warnings convert the return value to an int. CC: Eilon Greenstein <eilong@broadcom.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 89d27a3 commit 2b88f2d

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap)
21422142
return rval;
21432143
}
21442144

2145-
static u8 bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
2145+
static int bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
21462146
{
21472147
struct bnx2x *bp = netdev_priv(netdev);
21482148
u8 rval = 0;
@@ -2169,7 +2169,7 @@ static u8 bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num)
21692169
return rval;
21702170
}
21712171

2172-
static u8 bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num)
2172+
static int bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num)
21732173
{
21742174
struct bnx2x *bp = netdev_priv(netdev);
21752175
DP(NETIF_MSG_LINK, "num tcs = %d; Not supported\n", num);

‎drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static u8 ixgbe_dcbnl_getcap(struct net_device *netdev, int capid, u8 *cap)
490490
return 0;
491491
}
492492

493-
static u8 ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
493+
static int ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
494494
{
495495
struct ixgbe_adapter *adapter = netdev_priv(netdev);
496496
u8 rval = 0;
@@ -514,7 +514,7 @@ static u8 ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
514514
return rval;
515515
}
516516

517-
static u8 ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
517+
static int ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
518518
{
519519
return -EINVAL;
520520
}

‎include/net/dcbnl.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ struct dcbnl_rtnl_ops {
7272
void (*getpfccfg)(struct net_device *, int, u8 *);
7373
u8 (*setall)(struct net_device *);
7474
u8 (*getcap)(struct net_device *, int, u8 *);
75-
u8 (*getnumtcs)(struct net_device *, int, u8 *);
76-
u8 (*setnumtcs)(struct net_device *, int, u8);
75+
int (*getnumtcs)(struct net_device *, int, u8 *);
76+
int (*setnumtcs)(struct net_device *, int, u8);
7777
u8 (*getpfcstate)(struct net_device *);
7878
void (*setpfcstate)(struct net_device *, u8);
7979
void (*getbcncfg)(struct net_device *, int, u32 *);

0 commit comments

Comments
 (0)