Yet more sonarlint fixes

This commit is contained in:
Jasmine Iwanek
2023-05-29 01:30:51 -04:00
parent 2e6634da89
commit ed1b369abd
125 changed files with 2557 additions and 2279 deletions

View File

@@ -446,7 +446,8 @@ pcnetIsLinkUp(nic_t *dev)
static __inline int
pcnetTmdLoad(nic_t *dev, TMD *tmd, uint32_t addr, int fRetIfNotOwn)
{
uint8_t ownbyte, bytes[4] = { 0, 0, 0, 0 };
uint8_t ownbyte;
uint8_t bytes[4] = { 0, 0, 0, 0 };
uint16_t xda[4];
uint32_t xda32[4];
@@ -539,7 +540,8 @@ pcnetTmdStorePassHost(nic_t *dev, TMD *tmd, uint32_t addr)
static __inline int
pcnetRmdLoad(nic_t *dev, RMD *rmd, uint32_t addr, int fRetIfNotOwn)
{
uint8_t ownbyte, bytes[4] = { 0, 0, 0, 0 };
uint8_t ownbyte;
uint8_t bytes[4] = { 0, 0, 0, 0 };
uint16_t rda[4];
uint32_t rda32[4];
@@ -654,10 +656,10 @@ lnc_mchash(const uint8_t *ether_addr)
{
#define LNC_POLYNOMIAL 0xEDB88320UL
uint32_t crc = 0xFFFFFFFF;
int idx, bit;
int bit;
uint8_t data;
for (idx = 0; idx < ETHER_ADDR_LEN; idx++) {
for (uint8_t idx = 0; idx < ETHER_ADDR_LEN; idx++) {
for (data = *ether_addr++, bit = 0; bit < MULTICAST_FILTER_LEN; bit++) {
crc = (crc >> 1) ^ (((crc ^ data) & 1) ? LNC_POLYNOMIAL : 0);
data >>= 1;
@@ -915,7 +917,6 @@ pcnetUpdateIrq(nic_t *dev)
static void
pcnetInit(nic_t *dev)
{
int i;
pcnet_log(3, "%s: pcnetInit: init_addr=%#010x\n", dev->name, PHYSADDR(dev, CSR_IADR(dev)));
/** @todo Documentation says that RCVRL and XMTRL are stored as two's complement!
@@ -956,7 +957,7 @@ pcnetInit(nic_t *dev)
#undef PCNET_INIT
size_t cbRxBuffers = 0;
for (i = CSR_RCVRL(dev); i >= 1; i--) {
for (int i = CSR_RCVRL(dev); i >= 1; i--) {
RMD rmd;
uint32_t rdaddr = PHYSADDR(dev, pcnetRdraAddr(dev, i));
@@ -1200,8 +1201,10 @@ pcnetCalcPacketLen(nic_t *dev, int cb)
static int
pcnetReceiveNoSync(void *priv, uint8_t *buf, int size)
{
nic_t *dev = (nic_t *) priv;
int is_padr = 0, is_bcast = 0, is_ladr = 0;
nic_t *dev = (nic_t *) priv;
int is_padr = 0;
int is_bcast = 0;
int is_ladr = 0;
uint32_t iRxDesc;
int cbPacket;
uint8_t buf1[60];
@@ -1266,7 +1269,8 @@ pcnetReceiveNoSync(void *priv, uint8_t *buf, int size)
uint8_t *src = &dev->abRecvBuf[8];
uint32_t crda = CSR_CRDA(dev);
uint32_t next_crda;
RMD rmd, next_rmd;
RMD rmd;
RMD next_rmd;
/*
* Ethernet framing considers these two octets to be
@@ -1473,8 +1477,8 @@ pcnetAsyncTransmit(nic_t *dev)
break;
/* Don't continue sending packets when the link is down. */
if ((!pcnetIsLinkUp(dev)
&& dev->cLinkDownReported > PCNET_MAX_LINKDOWN_REPORTED))
if (!pcnetIsLinkUp(dev)
&& dev->cLinkDownReported > PCNET_MAX_LINKDOWN_REPORTED)
break;
pcnet_log(3, "%s: TMDLOAD %#010x\n", dev->name, PHYSADDR(dev, CSR_CXDA(dev)));
@@ -1488,7 +1492,7 @@ pcnetAsyncTransmit(nic_t *dev)
const int cb = 4096 - tmd.tmd1.bcnt;
pcnet_log(3, "%s: pcnetAsyncTransmit: stp&enp: cb=%d xmtrc=%#x\n", dev->name, cb, CSR_XMTRC(dev));
if ((pcnetIsLinkUp(dev) || fLoopback)) {
if (pcnetIsLinkUp(dev) || fLoopback) {
/* From the manual: ``A zero length buffer is acceptable as
* long as it is not the last buffer in a chain (STP = 0 and
@@ -2024,7 +2028,10 @@ static uint16_t
pcnet_mii_readw(nic_t *dev, uint16_t miiaddr)
{
uint16_t val;
int autoneg, duplex, fast, isolate;
int autoneg;
int duplex;
int fast;
int isolate;
/* If the DANAS (BCR32.7) bit is set, the MAC does not do any
* auto-negotiation and the PHY must be set up explicitly. DANAS
@@ -2238,7 +2245,7 @@ pcnet_byte_read(nic_t *dev, uint32_t addr)
pcnet_log(3, "%s: pcnet_word_read: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev));
return (val);
return val;
}
static uint16_t
@@ -2276,7 +2283,7 @@ pcnet_word_read(nic_t *dev, uint32_t addr)
skip_update_irq:
pcnet_log(3, "%s: pcnet_word_read: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev));
return (val);
return val;
}
static void
@@ -2300,7 +2307,7 @@ pcnet_dword_write(nic_t *dev, uint32_t addr, uint32_t val)
/* switch device to dword i/o mode */
pcnet_bcr_writew(dev, BCR_BSBC, pcnet_bcr_readw(dev, BCR_BSBC) | 0x0080);
pcnet_log(3, "%s: device switched into dword i/o mode\n", dev->name);
};
}
}
static uint32_t
@@ -2334,7 +2341,7 @@ pcnet_dword_read(nic_t *dev, uint32_t addr)
skip_update_irq:
pcnet_log(3, "%s: Read Long mode, addr = %08x, val = %08x\n", dev->name, addr, val);
return (val);
return val;
}
static void
@@ -2424,7 +2431,7 @@ pcnet_read(nic_t *dev, uint32_t addr, int len)
}
pcnet_log(3, "%s: value in read - %08x\n", dev->name, retval);
return (retval);
return retval;
}
static uint8_t
@@ -2682,7 +2689,7 @@ pcnet_pci_read(int func, int addr, void *p)
return 0xff;
}
return (0);
return 0;
}
static void
@@ -3005,7 +3012,7 @@ pcnet_init(const device_t *info)
timer_add(&dev->timer_restore, pcnetTimerRestore, dev, 0);
return (dev);
return dev;
}
static void