staging: brcm80211: brcmfmac/*: fix remaining 'assignment in if condition'
authorJason Cooper <jason@lakedaemon.net>
Wed, 6 Oct 2010 14:07:59 +0000 (10:07 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Oct 2010 15:20:41 +0000 (08:20 -0700)
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
drivers/staging/brcm80211/brcmfmac/dhd_common.c
drivers/staging/brcm80211/brcmfmac/linux_osl.c

index 453841fe72ed10fa121a12f42fb76f052877ee4f..f81823ebeb10f8c87db63cb285bacb58b33c24a2 100644 (file)
@@ -190,11 +190,13 @@ int bcmsdh_probe(struct device *dev)
        }
 #endif                         /* defined(OOB_INTR_ONLY) */
        /* 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__));
                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",
                          __func__, MALLOCED(osh)));
                goto err;
@@ -205,14 +207,14 @@ int bcmsdh_probe(struct device *dev)
        sdhc->dev = (void *)dev;
 
 #ifdef BCMLXSDMMC
-       if (!(sdh = bcmsdh_attach(osh, (void *)0,
-                (void **)&regs, irq))) {
+       sdh = bcmsdh_attach(osh, (void *)0, (void **)&regs, irq);
+       if (!sdh) {
                SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
                goto err;
        }
 #else
-       if (!(sdh = bcmsdh_attach(osh, (void *)r->start,
-                (void **)&regs, irq))) {
+       sdh = bcmsdh_attach(osh, (void *)r->start, (void **)&regs, irq);
+       if (!sdh) {
                SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
                goto err;
        }
@@ -232,9 +234,9 @@ int bcmsdh_probe(struct device *dev)
        vendevid = bcmsdh_query_device(sdh);
 
        /* try to attach to the target device */
-       if (!(sdhc->ch = drvinfo.attach((vendevid >> 16),
-                                       (vendevid & 0xFFFF), 0, 0, 0, 0,
-                                       (void *)regs, NULL, sdh))) {
+       sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
+                               0, 0, 0, 0, (void *)regs, NULL, sdh);
+       if (!sdhc->ch) {
                SDLX_MSG(("%s: device attach failed\n", __func__));
                goto err;
        }
@@ -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",
                          __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__));
                        goto err;
                }
@@ -420,11 +423,13 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         */
 
        /* 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__));
                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",
                          __func__, MALLOCED(osh)));
                goto err;
@@ -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__));
                goto err;
        }
-       if (!
-           (sdh =
-            bcmsdh_attach(osh, (void *)(uintptr) pci_resource_start(pdev, 0),
-                          (void **)&regs, pdev->irq))) {
+       sdh = bcmsdh_attach(osh, (void *)(uintptr) pci_resource_start(pdev, 0),
+                       (void **)&regs, pdev->irq);
+       if (!sdh) {
                SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
                goto err;
        }
@@ -452,9 +456,10 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        sdhc->sdh = sdh;
 
        /* try to attach to the target device */
-       if (!(sdhc->ch = drvinfo.attach(VENDOR_BROADCOM, /* pdev->vendor, */
-                                       bcmsdh_query_device(sdh) & 0xFFFF, 0, 0,
-                                       0, 0, (void *)regs, NULL, sdh))) {
+       sdhc->ch = drvinfo.attach(VENDOR_BROADCOM, /* pdev->vendor, */
+                               bcmsdh_query_device(sdh) & 0xFFFF, 0, 0, 0, 0,
+                               (void *)regs, NULL, sdh);
+       if (!sdhc->ch) {
                SDLX_MSG(("%s: device attach failed\n", __func__));
                goto err;
        }
@@ -531,7 +536,8 @@ int bcmsdh_register(bcmsdh_driver_t *driver)
 #endif                         /* defined(BCMPLATFORM_BUS) */
 
 #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;
 
        SDLX_MSG(("%s: pci_module_init failed 0x%x\n", __func__, error));
index c68c8a47965ee827c3cfb595a67847ed94d4a569..9db1cb7e688d33201bfa8ed8cf0f3c28ab7f709f 100644 (file)
@@ -1079,14 +1079,16 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
        char *arg_save = 0, *arg_org = 0;
 #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__));
                goto fail;
        }
 
        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__));
                goto fail;
        }
@@ -1764,15 +1766,14 @@ int dhd_pno_clean(dhd_pub_t *dhd)
        /* Disable pfn */
        iov_len =
            bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf));
-       if ((ret =
-            dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
-                             sizeof(iovbuf))) >= 0) {
+       ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
+       if (ret >= 0) {
                /* clear pfn */
                iov_len = bcm_mkiovar("pfnclear", 0, 0, iovbuf, sizeof(iovbuf));
                if (iov_len) {
-                       if ((ret =
-                            dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
-                                             iov_len)) < 0) {
+                       ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
+                                       iov_len);
+                       if (ret < 0) {
                                DHD_ERROR(("%s failed code %d\n", __func__,
                                           ret));
                        }
@@ -1797,12 +1798,12 @@ int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled)
        }
 
        /* Enable/disable PNO */
-       if ((ret =
-            bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf,
-                        sizeof(iovbuf))) > 0) {
-               if ((ret =
-                    dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
-                                     sizeof(iovbuf))) < 0) {
+       ret = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf,
+                       sizeof(iovbuf));
+       if (ret > 0) {
+               ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
+                               sizeof(iovbuf));
+               if (ret < 0) {
                        DHD_ERROR(("%s failed for error=%d\n", __func__, ret));
                        return ret;
                } else {
@@ -1854,7 +1855,8 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc
 #endif                         /* PNO_DUMP */
 
        /* 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));
                return err;
        }
@@ -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);
                pfn_element.ssid.SSID_len = ssids_local[i].SSID_len;
 
-               if ((err =
-                    bcm_mkiovar("pfn_add", (char *)&pfn_element,
-                                sizeof(pfn_element), iovbuf,
-                                sizeof(iovbuf))) > 0) {
-                       if ((err =
-                            dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
-                                             sizeof(iovbuf))) < 0) {
+               err = bcm_mkiovar("pfn_add", (char *)&pfn_element,
+                               sizeof(pfn_element), iovbuf, sizeof(iovbuf));
+               if (err > 0) {
+                       err = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf,
+                                       sizeof(iovbuf));
+                       if (err < 0) {
                                DHD_ERROR(("%s failed for i=%d error=%d\n",
                                           __func__, i, err));
                                return err;
index f98c05af7c790e216b993d720b16100dd032a5cf..c592a1573af642aa0226df1710fcac6e7228426f 100644 (file)
@@ -175,9 +175,9 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
 #ifdef DHD_USE_STATIC_BUF
 
        if (!bcm_static_buf) {
-               if (!(bcm_static_buf =
-                    (bcm_static_buf_t *) dhd_os_prealloc(3,
-                         STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN))) {
+               bcm_static_buf = (bcm_static_buf_t *) dhd_os_prealloc(3,
+                                       STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN);
+               if (!bcm_static_buf) {
                        printk(KERN_ERR "can not alloc static buf!\n");
                } else
                        printk(KERN_ERR "alloc static buf at %x!\n",
@@ -228,7 +228,8 @@ void *osl_pktget(osl_t *osh, uint len)
 {
        struct sk_buff *skb;
 
-       if ((skb = dev_alloc_skb(len))) {
+       skb = dev_alloc_skb(len);
+       if (skb) {
                skb_put(skb, len);
                skb->priority = 0;
 
@@ -428,7 +429,8 @@ void *osl_malloc(osl_t *osh, uint size)
 original:
 #endif                         /* DHD_USE_STATIC_BUF */
 
-       if ((addr = kmalloc(size, GFP_ATOMIC)) == NULL) {
+       addr = kmalloc(size, GFP_ATOMIC);
+       if (addr == NULL) {
                if (osh)
                        osh->failed++;
                return NULL;
@@ -577,7 +579,8 @@ void *osl_pktdup(osl_t *osh, void *skb)
 {
        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;
 
        if (osh->pub.pkttag)