Commit 81e95f9d authored by Jason Cooper's avatar Jason Cooper Committed by Greg Kroah-Hartman

staging: brcm80211: brcmfmac/*: fix remaining 'assignment in if condition'

Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 671a6e3c
...@@ -190,11 +190,13 @@ int bcmsdh_probe(struct device *dev) ...@@ -190,11 +190,13 @@ int bcmsdh_probe(struct device *dev)
} }
#endif /* defined(OOB_INTR_ONLY) */ #endif /* defined(OOB_INTR_ONLY) */
/* allocate SDIO Host Controller state info */ /* allocate SDIO Host Controller state info */
if (!(osh = osl_attach(dev, PCI_BUS, FALSE))) { osh = osl_attach(dev, PCI_BUS, FALSE);
if (!osh) {
SDLX_MSG(("%s: osl_attach failed\n", __func__)); SDLX_MSG(("%s: osl_attach failed\n", __func__));
goto err; goto err;
} }
if (!(sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t)))) { sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t));
if (!sdhc) {
SDLX_MSG(("%s: out of memory, allocated %d bytes\n", SDLX_MSG(("%s: out of memory, allocated %d bytes\n",
__func__, MALLOCED(osh))); __func__, MALLOCED(osh)));
goto err; goto err;
...@@ -205,14 +207,14 @@ int bcmsdh_probe(struct device *dev) ...@@ -205,14 +207,14 @@ int bcmsdh_probe(struct device *dev)
sdhc->dev = (void *)dev; sdhc->dev = (void *)dev;
#ifdef BCMLXSDMMC #ifdef BCMLXSDMMC
if (!(sdh = bcmsdh_attach(osh, (void *)0, sdh = bcmsdh_attach(osh, (void *)0, (void **)&regs, irq);
(void **)&regs, irq))) { if (!sdh) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__)); SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
goto err; goto err;
} }
#else #else
if (!(sdh = bcmsdh_attach(osh, (void *)r->start, sdh = bcmsdh_attach(osh, (void *)r->start, (void **)&regs, irq);
(void **)&regs, irq))) { if (!sdh) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__)); SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
goto err; goto err;
} }
...@@ -232,9 +234,9 @@ int bcmsdh_probe(struct device *dev) ...@@ -232,9 +234,9 @@ int bcmsdh_probe(struct device *dev)
vendevid = bcmsdh_query_device(sdh); vendevid = bcmsdh_query_device(sdh);
/* try to attach to the target device */ /* try to attach to the target device */
if (!(sdhc->ch = drvinfo.attach((vendevid >> 16), sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
(vendevid & 0xFFFF), 0, 0, 0, 0, 0, 0, 0, 0, (void *)regs, NULL, sdh);
(void *)regs, NULL, sdh))) { if (!sdhc->ch) {
SDLX_MSG(("%s: device attach failed\n", __func__)); SDLX_MSG(("%s: device attach failed\n", __func__));
goto err; goto err;
} }
...@@ -386,7 +388,8 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -386,7 +388,8 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
SDLX_MSG(("%s: Disabling TI FlashMedia Controller.\n", SDLX_MSG(("%s: Disabling TI FlashMedia Controller.\n",
__func__)); __func__));
if (!(osh = osl_attach(pdev, PCI_BUS, FALSE))) { osh = osl_attach(pdev, PCI_BUS, FALSE);
if (!osh) {
SDLX_MSG(("%s: osl_attach failed\n", __func__)); SDLX_MSG(("%s: osl_attach failed\n", __func__));
goto err; goto err;
} }
...@@ -420,11 +423,13 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -420,11 +423,13 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
*/ */
/* allocate SDIO Host Controller state info */ /* allocate SDIO Host Controller state info */
if (!(osh = osl_attach(pdev, PCI_BUS, FALSE))) { osh = osl_attach(pdev, PCI_BUS, FALSE);
if (!osh) {
SDLX_MSG(("%s: osl_attach failed\n", __func__)); SDLX_MSG(("%s: osl_attach failed\n", __func__));
goto err; goto err;
} }
if (!(sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t)))) { sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t));
if (!sdhc) {
SDLX_MSG(("%s: out of memory, allocated %d bytes\n", SDLX_MSG(("%s: out of memory, allocated %d bytes\n",
__func__, MALLOCED(osh))); __func__, MALLOCED(osh)));
goto err; goto err;
...@@ -441,10 +446,9 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -441,10 +446,9 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
SDLX_MSG(("%s: Cannot enable PCI device\n", __func__)); SDLX_MSG(("%s: Cannot enable PCI device\n", __func__));
goto err; goto err;
} }
if (! sdh = bcmsdh_attach(osh, (void *)(uintptr) pci_resource_start(pdev, 0),
(sdh = (void **)&regs, pdev->irq);
bcmsdh_attach(osh, (void *)(uintptr) pci_resource_start(pdev, 0), if (!sdh) {
(void **)&regs, pdev->irq))) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__)); SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
goto err; goto err;
} }
...@@ -452,9 +456,10 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -452,9 +456,10 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
sdhc->sdh = sdh; sdhc->sdh = sdh;
/* try to attach to the target device */ /* try to attach to the target device */
if (!(sdhc->ch = drvinfo.attach(VENDOR_BROADCOM, /* pdev->vendor, */ sdhc->ch = drvinfo.attach(VENDOR_BROADCOM, /* pdev->vendor, */
bcmsdh_query_device(sdh) & 0xFFFF, 0, 0, bcmsdh_query_device(sdh) & 0xFFFF, 0, 0, 0, 0,
0, 0, (void *)regs, NULL, sdh))) { (void *)regs, NULL, sdh);
if (!sdhc->ch) {
SDLX_MSG(("%s: device attach failed\n", __func__)); SDLX_MSG(("%s: device attach failed\n", __func__));
goto err; goto err;
} }
...@@ -531,7 +536,8 @@ int bcmsdh_register(bcmsdh_driver_t *driver) ...@@ -531,7 +536,8 @@ int bcmsdh_register(bcmsdh_driver_t *driver)
#endif /* defined(BCMPLATFORM_BUS) */ #endif /* defined(BCMPLATFORM_BUS) */
#if !defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC) #if !defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC)
if (!(error = pci_register_driver(&bcmsdh_pci_driver))) error = pci_register_driver(&bcmsdh_pci_driver);
if (!error)
return 0; return 0;
SDLX_MSG(("%s: pci_module_init failed 0x%x\n", __func__, error)); SDLX_MSG(("%s: pci_module_init failed 0x%x\n", __func__, error));
......
...@@ -1079,14 +1079,16 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) ...@@ -1079,14 +1079,16 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
char *arg_save = 0, *arg_org = 0; char *arg_save = 0, *arg_org = 0;
#define BUF_SIZE 2048 #define BUF_SIZE 2048
if (!(arg_save = MALLOC(dhd->osh, strlen(arg) + 1))) { arg_save = MALLOC(dhd->osh, strlen(arg) + 1);
if (!arg_save) {
DHD_ERROR(("%s: kmalloc failed\n", __func__)); DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail; goto fail;
} }
arg_org = arg_save; arg_org = arg_save;
if (!(buf = MALLOC(dhd->osh, BUF_SIZE))) { buf = MALLOC(dhd->osh, BUF_SIZE);
if (!buf) {
DHD_ERROR(("%s: kmalloc failed\n", __func__)); DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail; goto fail;
} }
...@@ -1764,15 +1766,14 @@ int dhd_pno_clean(dhd_pub_t *dhd) ...@@ -1764,15 +1766,14 @@ int dhd_pno_clean(dhd_pub_t *dhd)
/* Disable pfn */ /* Disable pfn */
iov_len = iov_len =
bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf)); bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf));
if ((ret = ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, if (ret >= 0) {
sizeof(iovbuf))) >= 0) {
/* clear pfn */ /* clear pfn */
iov_len = bcm_mkiovar("pfnclear", 0, 0, iovbuf, sizeof(iovbuf)); iov_len = bcm_mkiovar("pfnclear", 0, 0, iovbuf, sizeof(iovbuf));
if (iov_len) { if (iov_len) {
if ((ret = ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, iov_len);
iov_len)) < 0) { if (ret < 0) {
DHD_ERROR(("%s failed code %d\n", __func__, DHD_ERROR(("%s failed code %d\n", __func__,
ret)); ret));
} }
...@@ -1797,12 +1798,12 @@ int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled) ...@@ -1797,12 +1798,12 @@ int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled)
} }
/* Enable/disable PNO */ /* Enable/disable PNO */
if ((ret = ret = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf,
bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf));
sizeof(iovbuf))) > 0) { if (ret > 0) {
if ((ret = ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
sizeof(iovbuf))) < 0) { if (ret < 0) {
DHD_ERROR(("%s failed for error=%d\n", __func__, ret)); DHD_ERROR(("%s failed for error=%d\n", __func__, ret));
return ret; return ret;
} else { } else {
...@@ -1854,7 +1855,8 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc ...@@ -1854,7 +1855,8 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc
#endif /* PNO_DUMP */ #endif /* PNO_DUMP */
/* clean up everything */ /* clean up everything */
if ((err = dhd_pno_clean(dhd)) < 0) { err = dhd_pno_clean(dhd);
if (err < 0) {
DHD_ERROR(("%s failed error=%d\n", __func__, err)); DHD_ERROR(("%s failed error=%d\n", __func__, err));
return err; return err;
} }
...@@ -1886,13 +1888,12 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc ...@@ -1886,13 +1888,12 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc
ssids_local[i].SSID_len); ssids_local[i].SSID_len);
pfn_element.ssid.SSID_len = ssids_local[i].SSID_len; pfn_element.ssid.SSID_len = ssids_local[i].SSID_len;
if ((err = err = bcm_mkiovar("pfn_add", (char *)&pfn_element,
bcm_mkiovar("pfn_add", (char *)&pfn_element, sizeof(pfn_element), iovbuf, sizeof(iovbuf));
sizeof(pfn_element), iovbuf, if (err > 0) {
sizeof(iovbuf))) > 0) { err = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
if ((err = sizeof(iovbuf));
dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, if (err < 0) {
sizeof(iovbuf))) < 0) {
DHD_ERROR(("%s failed for i=%d error=%d\n", DHD_ERROR(("%s failed for i=%d error=%d\n",
__func__, i, err)); __func__, i, err));
return err; return err;
......
...@@ -175,9 +175,9 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag) ...@@ -175,9 +175,9 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
#ifdef DHD_USE_STATIC_BUF #ifdef DHD_USE_STATIC_BUF
if (!bcm_static_buf) { if (!bcm_static_buf) {
if (!(bcm_static_buf = bcm_static_buf = (bcm_static_buf_t *) dhd_os_prealloc(3,
(bcm_static_buf_t *) dhd_os_prealloc(3, STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN);
STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN))) { if (!bcm_static_buf) {
printk(KERN_ERR "can not alloc static buf!\n"); printk(KERN_ERR "can not alloc static buf!\n");
} else } else
printk(KERN_ERR "alloc static buf at %x!\n", printk(KERN_ERR "alloc static buf at %x!\n",
...@@ -228,7 +228,8 @@ void *osl_pktget(osl_t *osh, uint len) ...@@ -228,7 +228,8 @@ void *osl_pktget(osl_t *osh, uint len)
{ {
struct sk_buff *skb; struct sk_buff *skb;
if ((skb = dev_alloc_skb(len))) { skb = dev_alloc_skb(len);
if (skb) {
skb_put(skb, len); skb_put(skb, len);
skb->priority = 0; skb->priority = 0;
...@@ -428,7 +429,8 @@ void *osl_malloc(osl_t *osh, uint size) ...@@ -428,7 +429,8 @@ void *osl_malloc(osl_t *osh, uint size)
original: original:
#endif /* DHD_USE_STATIC_BUF */ #endif /* DHD_USE_STATIC_BUF */
if ((addr = kmalloc(size, GFP_ATOMIC)) == NULL) { addr = kmalloc(size, GFP_ATOMIC);
if (addr == NULL) {
if (osh) if (osh)
osh->failed++; osh->failed++;
return NULL; return NULL;
...@@ -577,7 +579,8 @@ void *osl_pktdup(osl_t *osh, void *skb) ...@@ -577,7 +579,8 @@ void *osl_pktdup(osl_t *osh, void *skb)
{ {
void *p; void *p;
if ((p = skb_clone((struct sk_buff *)skb, GFP_ATOMIC)) == NULL) p = skb_clone((struct sk_buff *)skb, GFP_ATOMIC);
if (p == NULL)
return NULL; return NULL;
if (osh->pub.pkttag) if (osh->pub.pkttag)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment