Code cleanup.
Roland Vossen (2):
staging: brcm80211: removed ASSERTs from util dir, part 1
staging: brcm80211: removed ASSERTs from util dir, part 2
drivers/staging/brcm80211/util/bcmotp.c | 36 +++++------------
drivers/staging/brcm80211/util/bcmsrom.c | 40 +------------------
drivers/staging/brcm80211/util/bcmutils.c | 30 ++------------
drivers/staging/brcm80211/util/bcmwifi.c | 4 --
drivers/staging/brcm80211/util/hnddma.c | 62 ++--------------------------
drivers/staging/brcm80211/util/nicpci.c | 14 +------
drivers/staging/brcm80211/util/qmath.c | 1 -
7 files changed, 21 insertions(+), 166 deletions(-)
Signed-off-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/util/bcmutils.c | 4 --
drivers/staging/brcm80211/util/bcmwifi.c | 4 --
drivers/staging/brcm80211/util/hnddma.c | 62 ++--------------------------
drivers/staging/brcm80211/util/nicpci.c | 14 +------
drivers/staging/brcm80211/util/qmath.c | 1 -
5 files changed, 6 insertions(+), 79 deletions(-)
diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c
index 6958ff7..fcb091e 100644
--- a/drivers/staging/brcm80211/util/bcmutils.c
+++ b/drivers/staging/brcm80211/util/bcmutils.c
@@ -281,8 +281,6 @@ void pktq_flush(struct pktq *pq, bool dir,
int prec;
for (prec = 0; prec < pq->num_prec; prec++)
pktq_pflush(pq, prec, dir, fn, arg);
- if (fn == NULL)
- ASSERT(pq->len == 0);
}
#endif /* BRCM_FULLMAC */
@@ -290,8 +288,6 @@ void pktq_init(struct pktq *pq, int num_prec, int max_len)
{
int prec;
- ASSERT(num_prec > 0 && num_prec <= PKTQ_MAX_PREC);
-
/* pq is variable size; only zero out what's requested */
memset(pq, 0,
offsetof(struct pktq, q) + (sizeof(struct pktq_prec) * num_prec));
diff --git a/drivers/staging/brcm80211/util/bcmwifi.c b/drivers/staging/brcm80211/util/bcmwifi.c
index d82c2b2..d15efd3 100644
--- a/drivers/staging/brcm80211/util/bcmwifi.c
+++ b/drivers/staging/brcm80211/util/bcmwifi.c
@@ -59,8 +59,6 @@ u8 wf_chspec_ctlchan(chanspec_t chspec)
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return CHSPEC_CHANNEL(chspec);
} else {
- /* we only support 40MHZ with sidebands */
- ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40);
/* chanspec channel holds the centre frequency, use that and the
* side band information to reconstruct the control channel number
*/
@@ -68,8 +66,6 @@ u8 wf_chspec_ctlchan(chanspec_t chspec)
/* control chan is the upper 20 MHZ SB of the 40MHZ channel */
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
- ASSERT(CHSPEC_CTL_SB(chspec) ==
- WL_CHANSPEC_CTL_SB_LOWER);
/* control chan is the lower 20 MHZ SB of the 40MHZ channel */
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
diff --git a/drivers/staging/brcm80211/util/hnddma.c b/drivers/staging/brcm80211/util/hnddma.c
index f3a1e45..54ac9d8 100644
--- a/drivers/staging/brcm80211/util/hnddma.c
+++ b/drivers/staging/brcm80211/util/hnddma.c
@@ -292,24 +292,9 @@ struct hnddma_pub *dma_attach(char *name, si_t *sih,
}
di->msg_level = msg_level ? msg_level : &dma_msg_level;
-
- /* old chips w/o sb is no longer supported */
- ASSERT(sih != NULL);
-
di->dma64 = ((ai_core_sflags(sih, 0, 0) & SISF_DMA64) == SISF_DMA64);
- /* check arguments */
- ASSERT(ISPOWEROF2(ntxd));
- ASSERT(ISPOWEROF2(nrxd));
-
- if (nrxd == 0)
- ASSERT(dmaregsrx == NULL);
- if (ntxd == 0)
- ASSERT(dmaregstx == NULL);
-
/* init dma reg pointer */
- ASSERT(ntxd <= D64MAXDD);
- ASSERT(nrxd <= D64MAXDD);
di->d64txregs = (dma64regs_t *) dmaregstx;
di->d64rxregs = (dma64regs_t *) dmaregsrx;
di->hnddma.di_fn = (const di_fcn_t *)&dma64proc;
@@ -488,8 +473,6 @@ dma64_dd_upd(dma_info_t *di, dma64dd_t *ddring, dmaaddr_t pa, uint outidx,
#else
if ((di->dataoffsetlow == 0) || !(PHYSADDRLO(pa) & PCI32ADDR_HIGH)) {
#endif /* defined(__mips__) && defined(IL_BIGENDIAN) */
- ASSERT((PHYSADDRHI(pa) & PCI64ADDR_HIGH) == 0);
-
W_SM(&ddring[outidx].addrlow,
BUS_SWAP32(PHYSADDRLO(pa) + di->dataoffsetlow));
W_SM(&ddring[outidx].addrhigh,
@@ -499,11 +482,8 @@ dma64_dd_upd(dma_info_t *di, dma64dd_t *ddring, dmaaddr_t pa, uint outidx,
} else {
/* address extension for 32-bit PCI */
u32 ae;
- ASSERT(di->addrext);
-
ae = (PHYSADDRLO(pa) & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT;
PHYSADDRLO(pa) &= ~PCI32ADDR_HIGH;
- ASSERT(PHYSADDRHI(pa) == 0);
ctrl2 |= (ae << D64_CTRL2_AE_SHIFT) & D64_CTRL2_AE;
W_SM(&ddring[outidx].addrlow,
@@ -544,10 +524,6 @@ static void _dma_detach(dma_info_t *di)
DMA_TRACE(("%s: dma_detach\n", di->name));
- /* shouldn't be here if descriptors are unreclaimed */
- ASSERT(di->txin == di->txout);
- ASSERT(di->rxin == di->rxout);
-
/* free dma descriptor rings */
if (di->txd64)
pci_free_consistent(di->pbus, di->txdalloc,
@@ -602,14 +578,14 @@ static bool _dma_isaddrext(dma_info_t *di)
if (!_dma64_addrext(di->d64txregs)) {
DMA_ERROR(("%s: _dma_isaddrext: DMA64 tx doesn't have "
"AE set\n", di->name));
- ASSERT(0);
+ return false;
}
return true;
} else if (di->d64rxregs != NULL) {
if (!_dma64_addrext(di->d64rxregs)) {
DMA_ERROR(("%s: _dma_isaddrext: DMA64 rx doesn't have "
"AE set\n", di->name));
- ASSERT(0);
+ return false;
}
return true;
}
@@ -642,8 +618,6 @@ static void _dma_ddtable_init(dma_info_t *di, uint direction, dmaaddr_t pa)
} else {
/* DMA64 32bits address extension */
u32 ae;
- ASSERT(di->addrext);
- ASSERT(PHYSADDRHI(pa) == 0);
/* shift the high bit(s) from pa to ae */
ae = (PHYSADDRLO(pa) & PCI32ADDR_HIGH) >>
@@ -783,7 +757,6 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
#ifdef BCMDBG
if (resid > 0) {
uint cur;
- ASSERT(p == NULL);
cur =
B2I(((R_REG(&di->d64rxregs->status0) &
D64_RS0_CD_MASK) -
@@ -874,10 +847,7 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
pa = pci_map_single(di->pbus, p->data,
di->rxbufsize, PCI_DMA_FROMDEVICE);
- ASSERT(IS_ALIGNED(PHYSADDRLO(pa), 4));
-
/* save the free packet pointer */
- ASSERT(di->rxp[rxout] == NULL);
di->rxp[rxout] = p;
/* reset flags for each descriptor */
@@ -1019,8 +989,6 @@ static uint _dma_ctrlflags(dma_info_t *di, uint mask, uint flags)
return 0;
}
- ASSERT((flags & ~mask) == 0);
-
dmactrlflags &= ~mask;
dmactrlflags |= flags;
@@ -1053,9 +1021,6 @@ static unsigned long _dma_getvar(dma_info_t *di, const char *name)
{
if (!strcmp(name, "&txavail"))
return (unsigned long)&(di->hnddma.txavail);
- else {
- ASSERT(0);
- }
return 0;
}
@@ -1063,8 +1028,6 @@ static
u8 dma_align_sizetobits(uint size)
{
u8 bitpos = 0;
- ASSERT(size);
- ASSERT(!(size & (size - 1)));
while (size >>= 1) {
bitpos++;
}
@@ -1230,12 +1193,8 @@ static bool dma64_alloc(dma_info_t *di, uint direction)
di->txdalign = (uint) ((s8 *)di->txd64 - (s8 *) va);
PHYSADDRLOSET(di->txdpa,
PHYSADDRLO(di->txdpaorig) + di->txdalign);
- /* Make sure that alignment didn't overflow */
- ASSERT(PHYSADDRLO(di->txdpa) >= PHYSADDRLO(di->txdpaorig));
-
PHYSADDRHISET(di->txdpa, PHYSADDRHI(di->txdpaorig));
di->txdalloc = alloced;
- ASSERT(IS_ALIGNED((unsigned long)di->txd64, align));
} else {
va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits,
&alloced, &di->rxdpaorig);
@@ -1248,12 +1207,8 @@ static bool dma64_alloc(dma_info_t *di, uint direction)
di->rxdalign = (uint) ((s8 *)di->rxd64 - (s8 *) va);
PHYSADDRLOSET(di->rxdpa,
PHYSADDRLO(di->rxdpaorig) + di->rxdalign);
- /* Make sure that alignment didn't overflow */
- ASSERT(PHYSADDRLO(di->rxdpa) >= PHYSADDRLO(di->rxdpaorig));
-
PHYSADDRHISET(di->rxdpa, PHYSADDRHI(di->rxdpaorig));
di->rxdalloc = alloced;
- ASSERT(IS_ALIGNED((unsigned long)di->rxd64, align));
}
return true;
@@ -1396,7 +1351,6 @@ static int dma64_txunframed(dma_info_t *di, void *buf, uint len, bool commit)
flags |= D64_CTRL1_EOT;
dma64_dd_upd(di, di->txd64, pa, txout, &flags, len);
- ASSERT(di->txp[txout] == NULL);
/* save the buffer pointer - used by dma_getpos */
di->txp[txout] = buf;
@@ -1501,7 +1455,6 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
pa = map->segs[j - 1].addr;
}
dma64_dd_upd(di, di->txd64, pa, txout, &flags, len);
- ASSERT(di->txp[txout] == NULL);
txout = NEXTTXD(txout);
}
@@ -1642,15 +1595,13 @@ static void *BCMFASTPATH dma64_getnexttxp(dma_info_t *di, txd_range_t range)
return NULL;
}
+/* if forcing, dma engine must be disabled */
static void *BCMFASTPATH dma64_getnextrxp(dma_info_t *di, bool forceall)
{
uint i, curr;
void *rxp;
dmaaddr_t pa;
- /* if forcing, dma engine must be disabled */
- ASSERT(!forceall || !dma64_rxenabled(di));
-
i = di->rxin;
/* return if no packets posted */
@@ -1667,7 +1618,6 @@ static void *BCMFASTPATH dma64_getnextrxp(dma_info_t *di, bool forceall)
/* get the packet pointer that corresponds to the rx descriptor */
rxp = di->rxp[i];
- ASSERT(rxp);
di->rxp[i] = NULL;
PHYSADDRLOSET(pa,
@@ -1699,6 +1649,7 @@ static bool _dma64_addrext(dma64regs_t *dma64regs)
/*
* Rotate all active tx dma ring entries "forward" by (ActiveDescriptor - txin).
+ * precondition: tx dma should be suspended/idle
*/
static void dma64_txrotate(dma_info_t *di)
{
@@ -1709,8 +1660,6 @@ static void dma64_txrotate(dma_info_t *di)
u32 w;
u16 first, last;
- ASSERT(dma64_txsuspendedidle(di));
-
nactive = _dma_txactive(di);
ad = (u16) (B2I
((((R_REG(&di->d64txregs->status1) &
@@ -1753,7 +1702,6 @@ static void dma64_txrotate(dma_info_t *di)
W_SM(&di->txd64[old].addrhigh, BUS_SWAP32(0xdeadbeef));
/* move the corresponding txp[] entry */
- ASSERT(di->txp[new] == NULL);
di->txp[new] = di->txp[old];
/* Move the map */
@@ -1789,7 +1737,7 @@ uint dma_addrwidth(si_t *sih, void *dmaregs)
(sih->buscoretype == PCIE_CORE_ID)))
return DMADDRWIDTH_64;
}
- ASSERT(0); /* DMA hardware not supported by this driver*/
+ /* DMA hardware not supported by this driver*/
return DMADDRWIDTH_64;
}
diff --git a/drivers/staging/brcm80211/util/nicpci.c b/drivers/staging/brcm80211/util/nicpci.c
index 8f80999..1e9ed15 100644
--- a/drivers/staging/brcm80211/util/nicpci.c
+++ b/drivers/staging/brcm80211/util/nicpci.c
@@ -83,8 +83,6 @@ void *pcicore_init(si_t *sih, void *pdev, void *regs)
{
pcicore_info_t *pi;
- ASSERT(sih->bustype == PCI_BUS);
-
/* alloc pcicore_info_t */
pi = kzalloc(sizeof(pcicore_info_t), GFP_ATOMIC);
if (pi == NULL) {
@@ -101,7 +99,6 @@ void *pcicore_init(si_t *sih, void *pdev, void *regs)
cap_ptr =
pcicore_find_pci_capability(pi->dev, PCI_CAP_PCIECAP_ID,
NULL, NULL);
- ASSERT(cap_ptr);
pi->pciecap_lcreg_offset = cap_ptr + PCIE_CAP_LINKCTRL_OFFSET;
} else
pi->regs.pciregs = (struct sbpciregs *) regs;
@@ -187,8 +184,6 @@ pcie_readreg(sbpcieregs_t *pcieregs, uint addrtype,
{
uint retval = 0xFFFFFFFF;
- ASSERT(pcieregs != NULL);
-
switch (addrtype) {
case PCIE_CONFIGREGS:
W_REG((&pcieregs->configaddr), offset);
@@ -201,7 +196,6 @@ pcie_readreg(sbpcieregs_t *pcieregs, uint addrtype,
retval = R_REG(&(pcieregs->pcieinddata));
break;
default:
- ASSERT(0);
break;
}
@@ -212,8 +206,6 @@ uint
pcie_writereg(sbpcieregs_t *pcieregs, uint addrtype,
uint offset, uint val)
{
- ASSERT(pcieregs != NULL);
-
switch (addrtype) {
case PCIE_CONFIGREGS:
W_REG((&pcieregs->configaddr), offset);
@@ -224,7 +216,6 @@ pcie_writereg(sbpcieregs_t *pcieregs, uint addrtype,
W_REG((&pcieregs->pcieinddata), val);
break;
default:
- ASSERT(0);
break;
}
return 0;
@@ -384,7 +375,6 @@ static void pcie_extendL1timer(pcicore_info_t *pi, bool extend)
static void pcie_clkreq_upd(pcicore_info_t *pi, uint state)
{
si_t *sih = pi->sih;
- ASSERT(PCIE_PUB(sih));
switch (state) {
case SI_DOATTACH:
@@ -416,7 +406,6 @@ static void pcie_clkreq_upd(pcicore_info_t *pi, uint state)
}
break;
default:
- ASSERT(0);
break;
}
}
@@ -529,13 +518,12 @@ static void pcie_misc_config_fixup(pcicore_info_t *pi)
/* quick hack for testing */
/* Needs to happen when coming out of 'standby'/'hibernate' */
+/* precondition: pi->sih->buscorerev == 7 */
static void pcie_war_noplldown(pcicore_info_t *pi)
{
sbpcieregs_t *pcieregs = pi->regs.pcieregs;
u16 *reg16;
- ASSERT(pi->sih->buscorerev == 7);
-
/* turn off serdes PLL down */
ai_corereg(pi->sih, SI_CC_IDX, offsetof(chipcregs_t, chipcontrol),
CHIPCTRL_4321_PLL_DOWN, CHIPCTRL_4321_PLL_DOWN);
diff --git a/drivers/staging/brcm80211/util/qmath.c b/drivers/staging/brcm80211/util/qmath.c
index 40c9929..e9cb2fe 100644
--- a/drivers/staging/brcm80211/util/qmath.c
+++ b/drivers/staging/brcm80211/util/qmath.c
@@ -555,7 +555,6 @@ void qm_log10(s32 N, s16 qN, s16 *log10N, s16 *qLog10N)
/* Logerithm of negative values is undefined.
* assert N is greater than 0.
*/
- /* ASSERT(N > 0); */
/* normalize the N. */
s16norm = qm_norm32(N);
--
1.7.1
Signed-off-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/util/bcmotp.c | 36 +++++++------------------
drivers/staging/brcm80211/util/bcmsrom.c | 40 +----------------------------
drivers/staging/brcm80211/util/bcmutils.c | 26 +++----------------
3 files changed, 15 insertions(+), 87 deletions(-)
diff --git a/drivers/staging/brcm80211/util/bcmotp.c b/drivers/staging/brcm80211/util/bcmotp.c
index d150c05..49464af 100644
--- a/drivers/staging/brcm80211/util/bcmotp.c
+++ b/drivers/staging/brcm80211/util/bcmotp.c
@@ -177,9 +177,6 @@ static u16 ipxotp_otpr(void *oh, chipcregs_t *cc, uint wn)
oi = (otpinfo_t *) oh;
- ASSERT(wn < oi->wsize);
- ASSERT(cc != NULL);
-
return R_REG(&cc->sromotp[wn]);
}
@@ -229,7 +226,7 @@ static int ipxotp_max_rgnsz(si_t *sih, int osizew)
ret = osizew * 2 - OTP_SZ_FU_72 - OTP_SZ_CHECKSUM;
break;
default:
- ASSERT(0); /* Don't konw about this chip */
+ break; /* Don't know about this chip */
}
return ret;
@@ -313,7 +310,6 @@ static void *ipxotp_init(si_t *sih)
otpinfo_t *oi;
/* Make sure we're running IPX OTP */
- ASSERT(OTPTYPE_IPX(sih->ccrev));
if (!OTPTYPE_IPX(sih->ccrev))
return NULL;
@@ -360,7 +356,6 @@ static void *ipxotp_init(si_t *sih)
/* Retrieve OTP region info */
idx = ai_coreidx(sih);
cc = ai_setcoreidx(sih, SI_CC_IDX);
- ASSERT(cc != NULL);
_ipxotp_init(oi, cc);
@@ -444,7 +439,6 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
idx = ai_coreidx(oi->sih);
cc = ai_setcoreidx(oi->sih, SI_CC_IDX);
- ASSERT(cc != NULL);
/* Read the data */
for (i = 0; i < sz; i++)
@@ -565,14 +559,8 @@ static int hndotp_size(void *oh)
static u16 hndotp_otpr(void *oh, chipcregs_t *cc, uint wn)
{
-#ifdef BCMDBG
- otpinfo_t *oi = (otpinfo_t *) oh;
-#endif
volatile u16 *ptr;
- ASSERT(wn < ((oi->size / 2) + OTP_RC_LIM_OFF));
- ASSERT(cc != NULL);
-
ptr = (volatile u16 *)((volatile char *)cc + CC_SROM_OTP);
return R_REG(&ptr[wn]);
}
@@ -582,10 +570,6 @@ static u16 hndotp_otproff(void *oh, chipcregs_t *cc, int woff)
otpinfo_t *oi = (otpinfo_t *) oh;
volatile u16 *ptr;
- ASSERT(woff >= (-((int)oi->size / 2)));
- ASSERT(woff < OTP_LIM_OFF);
- ASSERT(cc != NULL);
-
ptr = (volatile u16 *)((volatile char *)cc + CC_SROM_OTP);
return R_REG(&ptr[(oi->size / 2) + woff]);
@@ -640,11 +624,7 @@ static void *hndotp_init(si_t *sih)
goto out;
}
- /* As of right now, support only 4320a2, 4311a1 and 4312 */
- ASSERT((oi->ccrev == 12) || (oi->ccrev == 17)
- || (oi->ccrev == 22));
- if (!
- ((oi->ccrev == 12) || (oi->ccrev == 17)
+ if (!((oi->ccrev == 12) || (oi->ccrev == 17)
|| (oi->ccrev == 22)))
return NULL;
@@ -700,8 +680,14 @@ static int hndotp_read_region(void *oh, int region, u16 *data, uint *wlen)
chipcregs_t *cc;
int i;
- /* Only support HW region (no active chips use HND OTP SW region) */
- ASSERT(region == OTP_HW_REGION);
+
+ if (region != OTP_HW_REGION) {
+ /*
+ * Only support HW region
+ * (no active chips use HND OTP SW region)
+ * */
+ return -ENOTSUPP;
+ }
/* Region empty? */
st = oi->hwprot | oi->signvalid;
@@ -713,7 +699,6 @@ static int hndotp_read_region(void *oh, int region, u16 *data, uint *wlen)
idx = ai_coreidx(oi->sih);
cc = ai_setcoreidx(oi->sih, SI_CC_IDX);
- ASSERT(cc != NULL);
for (i = 0; i < (int)*wlen; i++)
data[i] = hndotp_otpr(oh, cc, i);
@@ -737,7 +722,6 @@ static int hndotp_nvread(void *oh, char *data, uint *len)
/* save the orig core */
idx = ai_coreidx(oi->sih);
cc = ai_setcoreidx(oi->sih, SI_CC_IDX);
- ASSERT(cc != NULL);
st = hndotp_status(oh);
if (!(st & (OTP_HW_REGION | OTP_SW_REGION))) {
diff --git a/drivers/staging/brcm80211/util/bcmsrom.c b/drivers/staging/brcm80211/util/bcmsrom.c
index bf058e4..61cee36 100644
--- a/drivers/staging/brcm80211/util/bcmsrom.c
+++ b/drivers/staging/brcm80211/util/bcmsrom.c
@@ -139,7 +139,6 @@ int srom_var_init(si_t *sih, uint bustype, void *curmap,
len = 0;
- ASSERT(bustype == bustype);
if (vars == NULL || count == NULL)
return 0;
@@ -152,14 +151,13 @@ int srom_var_init(si_t *sih, uint bustype, void *curmap,
return initvars_srom_si(sih, curmap, vars, count);
case PCI_BUS:
- ASSERT(curmap != NULL);
if (curmap == NULL)
return -1;
return initvars_srom_pci(sih, curmap, vars, count);
default:
- ASSERT(0);
+ break;
}
return -1;
}
@@ -276,8 +274,6 @@ static int otp_read_pci(si_t *sih, u16 *buf, uint bufsz)
uint sz = OTP_SZ_MAX / 2; /* size in words */
int err = 0;
- ASSERT(bufsz <= OTP_SZ_MAX);
-
otp = kzalloc(OTP_SZ_MAX, GFP_ATOMIC);
if (otp == NULL) {
return -EBADE;
@@ -322,7 +318,6 @@ static int initvars_table(char *start, char *end,
/* do it only when there is more than just the null string */
if (c > 1) {
char *vp = kmalloc(c, GFP_ATOMIC);
- ASSERT(vp != NULL);
if (!vp)
return -ENOMEM;
memcpy(vp, start, c);
@@ -404,11 +399,7 @@ static int initvars_flash_si(si_t *sih, char **vars, uint *count)
char *vp, *base;
int err;
- ASSERT(vars != NULL);
- ASSERT(count != NULL);
-
base = vp = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC);
- ASSERT(vp != NULL);
if (!vp)
return -ENOMEM;
@@ -434,7 +425,6 @@ static uint mask_shift(u16 mask)
if (mask & (1 << i))
return i;
}
- ASSERT(mask);
return 0;
}
@@ -445,19 +435,9 @@ static uint mask_width(u16 mask)
if (mask & (1 << i))
return (uint) (i - mask_shift(mask) + 1);
}
- ASSERT(mask);
return 0;
}
-#if defined(BCMDBG)
-static bool mask_valid(u16 mask)
-{
- uint shift = mask_shift(mask);
- uint width = mask_width(mask);
- return mask == ((~0 << shift) & ~(~0 << (shift + width)));
-}
-#endif /* BCMDBG */
-
static void _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, varbuf_t *b)
{
u16 w;
@@ -497,23 +477,15 @@ static void _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, varbuf_t *b)
varbuf_append(b, "%s=%pM", name, ea);
} else {
- ASSERT(mask_valid(srv->mask));
- ASSERT(mask_width(srv->mask));
-
w = srom[srv->off - off];
val = (w & srv->mask) >> mask_shift(srv->mask);
width = mask_width(srv->mask);
while (srv->flags & SRFL_MORE) {
srv++;
- ASSERT(srv->name != NULL);
-
if (srv->off == 0 || srv->off < off)
continue;
- ASSERT(mask_valid(srv->mask));
- ASSERT(mask_width(srv->mask));
-
w = srom[srv->off - off];
val +=
((w & srv->mask) >> mask_shift(srv->
@@ -577,8 +549,6 @@ static void _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, varbuf_t *b)
continue;
w = srom[pb + srv->off - off];
-
- ASSERT(mask_valid(srv->mask));
val = (w & srv->mask) >> mask_shift(srv->mask);
width = mask_width(srv->mask);
@@ -621,7 +591,6 @@ static int initvars_srom_pci(si_t *sih, void *curmap, char **vars, uint *count)
* from flash.
*/
srom = kmalloc(SROM_MAX, GFP_ATOMIC);
- ASSERT(srom != NULL);
if (!srom)
return -2;
@@ -703,11 +672,7 @@ static int initvars_srom_pci(si_t *sih, void *curmap, char **vars, uint *count)
goto errout;
}
- ASSERT(vars != NULL);
- ASSERT(count != NULL);
-
base = vp = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC);
- ASSERT(vp != NULL);
if (!vp) {
err = -2;
goto errout;
@@ -727,12 +692,9 @@ static int initvars_srom_pci(si_t *sih, void *curmap, char **vars, uint *count)
_initvars_srom_pci(sromrev, srom, 0, &b);
/* final nullbyte terminator */
- ASSERT(b.size >= 1);
vp = b.buf;
*vp++ = '\0';
- ASSERT((vp - base) <= MAXSZ_NVRAM_VARS);
-
varsdone:
err = initvars_table(base, vp, vars, count);
diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c
index 1acdc0e..6958ff7 100644
--- a/drivers/staging/brcm80211/util/bcmutils.c
+++ b/drivers/staging/brcm80211/util/bcmutils.c
@@ -51,8 +51,6 @@ void BCMFASTPATH pkt_buf_free_skb(struct sk_buff *skb)
struct sk_buff *nskb;
int nest = 0;
- ASSERT(skb);
-
/* perversion: we use skb->next to chain multi-skb packets */
while (skb) {
nskb = skb->next;
@@ -122,11 +120,8 @@ struct sk_buff *BCMFASTPATH pktq_penq(struct pktq *pq, int prec,
{
struct pktq_prec *q;
- ASSERT(prec >= 0 && prec < pq->num_prec);
- ASSERT(p->prev == NULL); /* queueing chains not allowed */
-
- ASSERT(!pktq_full(pq));
- ASSERT(!pktq_pfull(pq, prec));
+ if (pktq_full(pq) || pktq_pfull(pq, prec))
+ return NULL;
q = &pq->q[prec];
@@ -151,11 +146,8 @@ struct sk_buff *BCMFASTPATH pktq_penq_head(struct pktq *pq, int prec,
{
struct pktq_prec *q;
- ASSERT(prec >= 0 && prec < pq->num_prec);
- ASSERT(p->prev == NULL); /* queueing chains not allowed */
-
- ASSERT(!pktq_full(pq));
- ASSERT(!pktq_pfull(pq, prec));
+ if (pktq_full(pq) || pktq_pfull(pq, prec))
+ return NULL;
q = &pq->q[prec];
@@ -179,8 +171,6 @@ struct sk_buff *BCMFASTPATH pktq_pdeq(struct pktq *pq, int prec)
struct pktq_prec *q;
struct sk_buff *p;
- ASSERT(prec >= 0 && prec < pq->num_prec);
-
q = &pq->q[prec];
p = q->head;
@@ -205,8 +195,6 @@ struct sk_buff *BCMFASTPATH pktq_pdeq_tail(struct pktq *pq, int prec)
struct pktq_prec *q;
struct sk_buff *p, *prev;
- ASSERT(prec >= 0 && prec < pq->num_prec);
-
q = &pq->q[prec];
p = q->head;
@@ -245,7 +233,6 @@ void pktq_pflush(struct pktq *pq, int prec, bool dir)
pq->len--;
p = q->head;
}
- ASSERT(q->len == 0);
q->tail = NULL;
}
@@ -254,7 +241,6 @@ void pktq_flush(struct pktq *pq, bool dir)
int prec;
for (prec = 0; prec < pq->num_prec; prec++)
pktq_pflush(pq, prec, dir);
- ASSERT(pq->len == 0);
}
#else /* !BRCM_FULLMAC */
void
@@ -285,7 +271,6 @@ pktq_pflush(struct pktq *pq, int prec, bool dir,
}
if (q->head == NULL) {
- ASSERT(q->len == 0);
q->tail = NULL;
}
}
@@ -477,8 +462,6 @@ const bcm_iovar_t *bcm_iovar_lookup(const bcm_iovar_t *table, const char *name)
else
lookup_name = name;
- ASSERT(table != NULL);
-
for (vi = table; vi->name; vi++) {
if (!strcmp(vi->name, lookup_name))
return vi;
@@ -526,7 +509,6 @@ int bcm_iovar_lencheck(const bcm_iovar_t *vi, void *arg, int len, bool set)
default:
/* unknown type for length check in iovar info */
- ASSERT(0);
bcmerror = -ENOTSUPP;
}
--
1.7.1