Skip to contentSkip to conversation

drivers/staging: Hoist assigns from if

PATCH In review Joe Perches 3 participants 26 messages Mar 25, 2010 – Apr 28, 2010 Staging

lore
Share & tools
lore
#0 lore raw

cover drivers/staging: Hoist assigns from if

Used scripts/cvt_kernel.style.pl: --convert-hoist_assigns_from_if and verified visually.

checkpatch errors ignored

Joe Perches (13):
drivers/staging/cx25821: Hoist assign from if drivers/staging/dt3155: Hoist assign from if drivers/staging/otus/80211core: Hoist assign from if drivers/staging/otus: Hoist assign from if drivers/staging/rt2860: Hoist assign from if drivers/staging/rt2870: Hoist assign from if drivers/staging/rtl8187se: Hoist assign from if drivers/staging/rtl8192e: Hoist assign from if drivers/staging/rtl8192su: Hoist assign from if drivers/staging/rtl8192u: Hoist assign from if drivers/staging/vt6655: Hoist assign from if drivers/staging/vt6656: Hoist assign from if drivers/staging/wlags49_h2: Hoist assign from if

 drivers/staging/cx25821/cx25821-core.c             |    3 +-
 drivers/staging/dt3155/dt3155_drv.c                |   20 ++-
 drivers/staging/dt3155/dt3155_isr.c                |    3 +-
 drivers/staging/otus/80211core/cagg.c              |   34 +++--
 drivers/staging/otus/80211core/ccmd.c              |    3 +-
 drivers/staging/otus/80211core/cfunc.c             |    3 +-
 drivers/staging/otus/80211core/cic.c               |    9 +-
 drivers/staging/otus/80211core/cinit.c             |    3 +-
 drivers/staging/otus/80211core/cmm.c               |  144 +++++++++++++-------
 drivers/staging/otus/80211core/cmmap.c             |  103 +++++++++-----
 drivers/staging/otus/80211core/cmmsta.c            |  123 +++++++++++------
 drivers/staging/otus/80211core/coid.c              |    3 +-
 drivers/staging/otus/80211core/cpsmgr.c            |    3 +-
 drivers/staging/otus/80211core/ctxrx.c             |   81 +++++++----
 drivers/staging/otus/80211core/queue.c             |    5 +-
 drivers/staging/otus/80211core/ratectrl.c          |    3 +-
 drivers/staging/otus/hal/hpmain.c                  |   30 +++--
 drivers/staging/otus/usbdrv.c                      |    6 +-
 drivers/staging/otus/zdusb.c                       |    3 +-
 drivers/staging/rt2860/common/cmm_data.c           |    6 +-
 drivers/staging/rt2860/common/cmm_wpa.c            |   18 +--
 drivers/staging/rt2860/common/spectrum.c           |    7 +-
 drivers/staging/rt2860/pci_main_dev.c              |    6 +-
 drivers/staging/rt2860/rt_linux.c                  |    7 +-
 drivers/staging/rt2870/common/rtusb_bulk.c         |   15 ++-
 drivers/staging/rt2870/common/rtusb_io.c           |   10 +-
 .../rtl8187se/ieee80211/ieee80211_softmac.c        |    3 +-
 drivers/staging/rtl8187se/r8180_core.c             |    6 +-
 .../staging/rtl8192e/ieee80211/ieee80211_softmac.c |    3 +-
 drivers/staging/rtl8192e/r8192E_core.c             |    6 +-
 .../rtl8192su/ieee80211/ieee80211_softmac.c        |    3 +-
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |    3 +-
 drivers/staging/vt6655/desc.h                      |    6 +-
 drivers/staging/vt6655/device.h                    |    6 +-
 drivers/staging/vt6655/device_main.c               |    3 +-
 drivers/staging/vt6655/iwctl.c                     |    3 +-
 drivers/staging/vt6656/main_usb.c                  |   12 +-
 drivers/staging/vt6656/usbpipe.c                   |   21 ++-
 drivers/staging/wlags49_h2/hcf.c                   |   15 ++-
 drivers/staging/wlags49_h2/wl_main.c               |    3 +-
 drivers/staging/wlags49_h2/wl_netdev.c             |   12 +-
 drivers/staging/wlags49_h2/wl_priv.c               |    9 +-
 drivers/staging/wlags49_h2/wl_sysfs.c              |    3 +-
 43 files changed, 496 insertions(+), 272 deletions(-)
#1 lore raw

PATCH 1/13 drivers/staging/cx25821: Hoist assign from if

---
 drivers/staging/cx25821/cx25821-core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/cx25821/cx25821-core.c +2 -1
index 67f689d..0548864 100644
@@ -1298,7 +1298,8 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci,
 	instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
 	instructions += 1;
 
-	if ((rc = btcx_riscmem_alloc(pci, risc, instructions * 12)) < 0)
+	rc = btcx_riscmem_alloc(pci, risc, instructions * 12);
+	if (rc < 0)
 		return rc;
 
 	/* write risc instructions */
Signature · 1 line
1.7.0.14.g7e948
#2 lore raw

PATCH 2/13 drivers/staging/dt3155: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/dt3155/dt3155_drv.c |   20 ++++++++++++--------
 drivers/staging/dt3155/dt3155_isr.c |    3 ++-
 2 files changed, 14 insertions(+), 9 deletions(-)
drivers/staging/dt3155/dt3155_drv.c +12 -8
index a67c622..4a073c4 100644
@@ -788,7 +788,8 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf,
   /* non-blocking reads should return if no data */
   if (filep->f_flags & O_NDELAY)
     {
-      if ((frame_index = dt3155_get_ready_buffer(minor)) < 0) {
+      frame_index = dt3155_get_ready_buffer(minor);
+      if (frame_index < 0) {
 	/*printk( "dt3155:  no buffers available (?)\n");*/
 	/* 		printques(minor); */
 	return -EAGAIN;
@@ -878,8 +879,8 @@ static int find_PCI (void)
       pci_index ++;
 
       /* Is it really there? */
-      if ((error =
-	   pci_read_config_word(pci_dev, PCI_CLASS_DEVICE, &rev_device)))
+      error = pci_read_config_word(pci_dev, PCI_CLASS_DEVICE, &rev_device);
+      if (error)
 	continue;
 
       /* Found a board */
@@ -897,8 +898,8 @@ static int find_PCI (void)
 
       /* Now, just go out and make sure that this/these device(s) is/are
 	 actually mapped into the kernel address space */
-      if ((error = pci_read_config_dword( pci_dev, PCI_BASE_ADDRESS_0,
-					  (u32 *) &base)))
+      error = pci_read_config_dword(pci_dev, PCI_BASE_ADDRESS_0, (u32 *)&base);
+      if (error)
 	{
 	  printk("DT3155: Was not able to find device \n");
 	  goto err;
@@ -919,7 +920,8 @@ static int find_PCI (void)
 	  goto err;
 	}
 
-      if ( (error = pci_read_config_byte( pci_dev, PCI_INTERRUPT_LINE, &irq)) )
+      error = pci_read_config_byte( pci_dev, PCI_INTERRUPT_LINE, &irq);
+      if (error)
 	{
 	  printk("DT3155: Was not able to find device \n");
 	  goto err;
@@ -995,7 +997,8 @@ int init_module(void)
   /* Now let's find the hardware.  find_PCI() will set ndevices to the
    * number of cards found in this machine. */
     {
-      if ( (rcode = find_PCI()) !=  DT_3155_SUCCESS )
+      rcode = find_PCI();
+      if (rcode !=  DT_3155_SUCCESS)
 	{
 	  printk("DT3155 error: find_PCI() failed to find dt3155 board(s)\n");
 	  unregister_chrdev( dt3155_major, "dt3155" );
@@ -1004,7 +1007,8 @@ int init_module(void)
     }
 
   /* Ok, time to setup the frame buffers */
-  if( (rcode = dt3155_setup_buffers(&allocatorAddr)) < 0 )
+  rcode = dt3155_setup_buffers(&allocatorAddr);
+  if (rcode < 0)
     {
       printk("DT3155: Error: setting up buffer not large enough.");
       unregister_chrdev( dt3155_major, "dt3155" );
drivers/staging/dt3155/dt3155_isr.c +2 -1
index fd7f93d..4109ea0 100644
@@ -269,7 +269,8 @@ void allocate_buffers (u32 *buf_addr, u32* total_size_kbs,
   printk("DT3155: ...the allocator has: %d KB\n", allocator_max);
   size_kbs = (full_size_kbs <= allocator_max ? full_size_kbs : allocator_max);
   if (size_kbs > min_size_kbs) {
-    if ((*buf_addr = allocator_allocate_dma (size_kbs, GFP_KERNEL)) != 0) {
+    *buf_addr = allocator_allocate_dma(size_kbs, GFP_KERNEL);
+    if (*buf_addr != 0) {
       printk("DT3155:  Managed to allocate: %d KB\n", size_kbs);
       *total_size_kbs = size_kbs;
       return;
Signature · 1 line
1.7.0.14.g7e948
#3 lore raw

Re: [PATCH 02/13] drivers/staging/dt3155: Hoist assign from if

Quoted 5 lines · Joe Perches
---
 drivers/staging/dt3155/dt3155_drv.c |   20 ++++++++++++--------
 drivers/staging/dt3155/dt3155_isr.c |    3 ++-

This doesn't apply anymore to linux-next, care to respin it?

thanks,

greg k-h

#4 lore raw

PATCH 3/13 drivers/staging/otus/80211core: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/otus/80211core/cagg.c     |   34 ++++---
 drivers/staging/otus/80211core/ccmd.c     |    3 +-
 drivers/staging/otus/80211core/cfunc.c    |    3 +-
 drivers/staging/otus/80211core/cic.c      |    9 +-
 drivers/staging/otus/80211core/cinit.c    |    3 +-
 drivers/staging/otus/80211core/cmm.c      |  144 +++++++++++++++++++----------
 drivers/staging/otus/80211core/cmmap.c    |  103 ++++++++++++++-------
 drivers/staging/otus/80211core/cmmsta.c   |  123 ++++++++++++++++---------
 drivers/staging/otus/80211core/coid.c     |    3 +-
 drivers/staging/otus/80211core/cpsmgr.c   |    3 +-
 drivers/staging/otus/80211core/ctxrx.c    |   81 +++++++++++------
 drivers/staging/otus/80211core/queue.c    |    5 +-
 drivers/staging/otus/80211core/ratectrl.c |    3 +-
 13 files changed, 339 insertions(+), 178 deletions(-)
drivers/staging/otus/80211core/cagg.c +21 -13
index f9514c0..c3cef1a 100644
@@ -2485,7 +2485,7 @@ void zfAggTxRetransmit(zdev_t* dev, struct bufInfo *buf_info, struct aggControl
         BAW->insert(dev, buf_info->buf, tid_tx->bar_ssn >> 4, aggControl->tid_baw, buf_info->baw_retransmit, &header_r);
     }*/
 
-    if ((err = zfHpSend(dev,
+    err = zfHpSend(dev,
                     buf_info->baw_header->header,
                     buf_info->baw_header->headerLen,
                     buf_info->baw_header->snap,
@@ -2496,7 +2496,8 @@ void zfAggTxRetransmit(zdev_t* dev, struct bufInfo *buf_info, struct aggControl
                     buf_info->baw_header->removeLen,
                     ZM_EXTERNAL_ALLOC_BUF,
                     (u8_t)tid_tx->ac,
-                    buf_info->baw_header->keyIdx)) != ZM_SUCCESS)
+                    buf_info->baw_header->keyIdx);
+    if (err != ZM_SUCCESS)
     {
         goto zlError;
     }
@@ -2797,9 +2798,10 @@ u16_t zfAggTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port, u16_t bufType, u8_t f
             BAW->insert(dev, buf, tid_tx->bar_ssn >> 4, aggControl->tid_baw, 0, &header_r);
         }*/
 
-        if ((err = zfHpSend(dev, header, headerLen, snap, snapLen,
+        err = zfHpSend(dev, header, headerLen, snap, snapLen,
                              mic, micLen, frag.buf[i], removeLen,
-                             frag.bufType[i], zcUpToAc[up&0x7], keyIdx)) != ZM_SUCCESS)
+                             frag.bufType[i], zcUpToAc[up&0x7], keyIdx);
+        if (err != ZM_SUCCESS)
         {
             goto zlError;
         }
@@ -2849,7 +2851,8 @@ u16_t   zfAggSendAddbaRequest(zdev_t* dev, u16_t *dst, u16_t ac, u16_t up)
     /*
      * TBD : Maximum size of management frame
      */
-    if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+    buf = zfwBufAllocate(dev, 1024);
+    if (buf == NULL)
     {
         zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
         return ZM_SUCCESS;
@@ -2892,8 +2895,9 @@ u16_t   zfAggSendAddbaRequest(zdev_t* dev, u16_t *dst, u16_t ac, u16_t up)
     //zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
 
     #if 0
-    if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
-            ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+    err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+		   ZM_INTERNAL_ALLOC_BUF, 0, 0xff);
+    if (err != ZM_SUCCESS)
     {
         goto zlError;
     }
@@ -3290,7 +3294,8 @@ u16_t   zfAggSendAddbaResponse(zdev_t* dev, struct aggBaFrameParameter *bf)
     /*
      * TBD : Maximum size of management frame
      */
-    if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+    buf = zfwBufAllocate(dev, 1024);
+    if (buf == NULL)
     {
         zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
         return ZM_SUCCESS;
@@ -3337,8 +3342,9 @@ u16_t   zfAggSendAddbaResponse(zdev_t* dev, struct aggBaFrameParameter *bf)
     //zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
 
     #if 0
-    if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
-            ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+    err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+		   ZM_INTERNAL_ALLOC_BUF, 0, 0xff);
+    if (err != ZM_SUCCESS)
     {
         goto zlError;
     }
@@ -3443,7 +3449,8 @@ u16_t   zfAggSendBar(zdev_t* dev, TID_TX tid_tx, struct aggBarControl *aggBarCon
     /*
      * TBD : Maximum size of management frame
      */
-    if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
+    buf = zfwBufAllocate(dev, 1024);
+    if (buf == NULL)
     {
         zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
         return ZM_SUCCESS;
@@ -3486,8 +3493,9 @@ u16_t   zfAggSendBar(zdev_t* dev, TID_TX tid_tx, struct aggBarControl *aggBarCon
     //zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
 
     #if 0
-    if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
-            ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
+    err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
+		   ZM_INTERNAL_ALLOC_BUF, 0, 0xff);
+    if (err != ZM_SUCCESS)
     {
         goto zlError;
     }
drivers/staging/otus/80211core/ccmd.c +2 -1
index 3e3d9b5..ab300df 100644
@@ -1436,7 +1436,8 @@ u16_t zfiWlanDeauth(zdev_t *dev, u16_t *macAddr, u16_t reason)
 		*/
 
 		/*
-		if ((id = zfApFindSta(dev, macAddr)) != 0xffff)
+		id = zfApFindSta(dev, macAddr);
+		if (id != 0xffff)
 		{
 			u32_t key[8];
 			u16_t nullAddr[3] = { 0x0, 0x0, 0x0 };
drivers/staging/otus/80211core/cfunc.c +2 -1
index e0a9f38..3b9341b 100644
@@ -1072,7 +1072,8 @@ u16_t zfFindCleanFrequency(zdev_t* dev, u32_t adhocMode)
 
     zmw_get_wlan_dev(dev);
 
-    if ((pBssInfo = wd->sta.bssList.head) == NULL)
+    pBssInfo = wd->sta.bssList.head;
+    if (pBssInfo == NULL)
     {
         if( adhocMode == ZM_ADHOCBAND_B || adhocMode == ZM_ADHOCBAND_G ||
             adhocMode == ZM_ADHOCBAND_BG || adhocMode == ZM_ADHOCBAND_ABG )
drivers/staging/otus/80211core/cic.c +6 -3
index c84f079..53c09a0 100644
@@ -329,7 +329,8 @@ void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp)
         if (wd->wlanMode == ZM_MODE_AP)
         {
             zmw_enter_critical_section(dev);
-            if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
+            i = zfApFindSta(dev, (u16_t*)rsp);
+            if (i != 0xffff)
             {
                 zfRateCtrlTxFailEvent(dev, &wd->ap.staTable[i].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
             }
@@ -357,7 +358,8 @@ void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp)
         if (wd->wlanMode == ZM_MODE_AP)
         {
             zmw_enter_critical_section(dev);
-            if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
+            i = zfApFindSta(dev, (u16_t*)rsp);
+            if (i != 0xffff)
             {
                 zfRateCtrlTxFailEvent(dev, &wd->ap.staTable[i].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
             }
@@ -387,7 +389,8 @@ void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp)
         if (wd->wlanMode == ZM_MODE_AP)
         {
             zmw_enter_critical_section(dev);
-            if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
+            i = zfApFindSta(dev, (u16_t*)rsp);
+            if (i != 0xffff)
             {
                 zfRateCtrlTxSuccessEvent(dev, &wd->ap.staTable[i].rcCell, zfPhyCtrlToRate(retryRate));
             }
drivers/staging/otus/80211core/cinit.c +2 -1
index 5f853ce..1182331 100644
@@ -622,7 +622,8 @@ u16_t zfTxGenWlanHeader(zdev_t* dev, zbuf_t* buf, u16_t* header, u16_t seq,
             phyCtrl = 0xc0001;   //PHY control L
 
             /* WDS port checking */
-            if ((wdsPort = (port - 0x20)) >= ZM_MAX_WDS_SUPPORT)
+            wdsPort = port - 0x20;
+            if (wdsPort >= ZM_MAX_WDS_SUPPORT)
             {
                 wdsPort = 0;
             }
drivers/staging/otus/80211core/cmm.c +95 -49

390 lines not on this page · raw message

drivers/staging/otus/80211core/cmmap.c +68 -35

302 lines not on this page · raw message

drivers/staging/otus/80211core/cmmsta.c +81 -42

343 lines not on this page · raw message

drivers/staging/otus/80211core/coid.c +2 -1
index 0524e1f..229aed8 100644
@@ -553,7 +553,8 @@ u8_t zfiWlanSetKey(zdev_t* dev, struct zsKeyInfo keyInfo)
         if (keyInfo.flag & ZM_KEY_FLAG_PK)
         {
             /* Find STA's information */
-            if ((id = zfApFindSta(dev, keyInfo.macAddr)) == 0xffff)
+            id = zfApFindSta(dev, keyInfo.macAddr);
+            if (id == 0xffff)
             {
                 /* Can't STA in the staTable */
                 return ZM_STATUS_FAILURE;
drivers/staging/otus/80211core/cpsmgr.c +2 -1
index 98e1f0c..32313be 100644
@@ -602,7 +602,8 @@ void zfPowerSavingMgrProcessBeacon(zdev_t* dev, zbuf_t* buf)
 
     wd->sta.psMgr.isSleepAllowed = 1;
 
-    if ( (offset=zfFindElement(dev, buf, ZM_WLAN_EID_TIM)) != 0xffff )
+    offset = zfFindElement(dev, buf, ZM_WLAN_EID_TIM);
+    if (offset != 0xffff)
     {
         length = zmw_rx_buf_readb(dev, buf, offset+1);
 
drivers/staging/otus/80211core/ctxrx.c +53 -28

209 lines not on this page · raw message

drivers/staging/otus/80211core/queue.c +3 -2
index d294831..29be4bd 100644
@@ -31,8 +31,9 @@ struct zsQueue* zfQueueCreate(zdev_t* dev, u16_t size)
 {
     struct zsQueue* q;
 
-    if ((q = (struct zsQueue*)zfwMemAllocate(dev, sizeof(struct zsQueue)
-            + (sizeof(struct zsQueueCell)*(size-1)))) != NULL)
+    q = (struct zsQueue*)zfwMemAllocate(dev, sizeof(struct zsQueue)
+            + (sizeof(struct zsQueueCell)*(size-1)));
+    if (q != NULL)
     {
         q->size = size;
         q->sizeMask = size-1;
drivers/staging/otus/80211core/ratectrl.c +2 -1
index a43104c..a1abe2f 100644
@@ -538,7 +538,8 @@ u16_t zfRateCtrlGetTxRate(zdev_t* dev, struct zsRcCell* rcCell, u16_t* probing)
             ((rcCell->currentRate <= 16) &&
             ((wd->PER[rcCell->currentRate]/2) <= ZM_RATE_PROBING_THRESHOLD)))
         {
-            if ((newRate=zfRateCtrlGetHigherRate(rcCell)) != rcCell->currentRate)
+            newRate = zfRateCtrlGetHigherRate(rcCell);
+            if (newRate != rcCell->currentRate)
             {
                 *probing = 1;
                 wd->probeCount++;
Signature · 1 line
1.7.0.14.g7e948
#5 lore raw

PATCH 4/13 drivers/staging/otus: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/otus/hal/hpmain.c |   30 ++++++++++++++++++------------
 drivers/staging/otus/usbdrv.c     |    6 ++++--
 drivers/staging/otus/zdusb.c      |    3 ++-
 3 files changed, 24 insertions(+), 15 deletions(-)
drivers/staging/otus/hal/hpmain.c +18 -12
index 8dff5b9..5f412e0 100644
@@ -142,8 +142,9 @@ u16_t zfHpInit(zdev_t* dev, u32_t frequency)
     if (wd->modeMDKEnable)
     {
         /* download the MDK firmware */
-        if ((ret = zfFirmwareDownload(dev, (u32_t*)zcDKFwImage,
-                (u32_t)zcDKFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+        ret = zfFirmwareDownload(dev, (u32_t*)zcDKFwImage,
+                (u32_t)zcDKFwImageSize, ZM_FIRMWARE_WLAN_ADDR);
+        if (ret != ZM_SUCCESS)
         {
             /* TODO : exception handling */
             //return 1;
@@ -153,8 +154,9 @@ u16_t zfHpInit(zdev_t* dev, u32_t frequency)
     {
     #ifndef ZM_OTUS_LINUX_PHASE_2
         /* download the normal firmware */
-        if ((ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
-                (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+        ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
+                (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR);
+        if (ret != ZM_SUCCESS)
         {
             /* TODO : exception handling */
             //return 1;
@@ -162,16 +164,18 @@ u16_t zfHpInit(zdev_t* dev, u32_t frequency)
     #else
 
         // 1-PH fw: ReadMac() store some global variable
-        if ((ret = zfFirmwareDownloadNotJump(dev, (u32_t*)zcFwBufImage,
-                (u32_t)zcFwBufImageSize, 0x102800)) != ZM_SUCCESS)
+        ret = zfFirmwareDownloadNotJump(dev, (u32_t*)zcFwBufImage,
+                (u32_t)zcFwBufImageSize, 0x102800);
+        if (ret != ZM_SUCCESS)
         {
             DbgPrint("Dl zcFwBufImage failed!");
         }
 
         zfwSleep(dev, 1000);
 
-        if ((ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
-                (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+        ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
+                (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR);
+        if (ret != ZM_SUCCESS)
         {
             DbgPrint("Dl zcFwBufImage failed!");
         }
@@ -249,15 +253,17 @@ u16_t zfHpReinit(zdev_t* dev, u32_t frequency)
 
     #ifndef ZM_OTUS_LINUX_PHASE_2
     /* Download firmware */
-    if ((ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
-            (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+    ret = zfFirmwareDownload(dev, (u32_t*)zcFwImage,
+            (u32_t)zcFwImageSize, ZM_FIRMWARE_WLAN_ADDR);
+    if (ret != ZM_SUCCESS)
     {
         /* TODO : exception handling */
         //return 1;
     }
     #else
-    if ((ret = zfFirmwareDownload(dev, (u32_t*)zcP2FwImage,
-            (u32_t)zcP2FwImageSize, ZM_FIRMWARE_WLAN_ADDR)) != ZM_SUCCESS)
+    ret = zfFirmwareDownload(dev, (u32_t*)zcP2FwImage,
+            (u32_t)zcP2FwImageSize, ZM_FIRMWARE_WLAN_ADDR);
+    if (ret != ZM_SUCCESS)
     {
         /* TODO : exception handling */
         //return 1;
drivers/staging/otus/usbdrv.c +4 -2
index 5e6a120..7c8e34d 100644
@@ -349,7 +349,8 @@ int usbdrv_open(struct net_device *dev)
     }
 
     size = zfiGlobalDataSize(dev);
-    if ((mem = kmalloc(size, GFP_KERNEL)) == NULL)
+    mem = kmalloc(size, GFP_KERNEL);
+    if (mem == NULL)
     {
         rc = -EBUSY;
         goto exit;
@@ -697,7 +698,8 @@ void usbdrv_remove1(struct pci_dev *pcid)
     struct net_device *dev;
     struct usbdrv_private *macp;
 
-    if (!(dev = (struct net_device *) pci_get_drvdata(pcid)))
+    dev = (struct net_device *)pci_get_drvdata(pcid);
+    if (!dev)
         return;
 
     macp = dev->ml_priv;
drivers/staging/otus/zdusb.c +2 -1
index 4cd9b7f..e7cdb48 100644
@@ -94,7 +94,8 @@ static int zfLnxProbe(struct usb_interface *interface,
         printk(KERN_NOTICE "USB 1.1 Host\n");
 #endif
 
-    if (!(macp = kmalloc(sizeof(struct usbdrv_private), GFP_KERNEL)))
+    macp = kmalloc(sizeof(struct usbdrv_private), GFP_KERNEL);
+    if (!macp)
     {
         printk(KERN_ERR "out of memory allocating device structure\n");
         result = -ENOMEM;
Signature · 1 line
1.7.0.14.g7e948
#6 lore raw

PATCH 5/13 drivers/staging/rt2860: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/rt2860/common/cmm_data.c |    6 ++++--
 drivers/staging/rt2860/common/cmm_wpa.c  |   18 ++++++++----------
 drivers/staging/rt2860/common/spectrum.c |    7 ++++---
 drivers/staging/rt2860/pci_main_dev.c    |    6 ++++--
 drivers/staging/rt2860/rt_linux.c        |    7 ++++---
 5 files changed, 24 insertions(+), 20 deletions(-)
drivers/staging/rt2860/common/cmm_data.c +4 -2
index 68263ce..65b00e6 100644
@@ -773,7 +773,8 @@ void RTMPDeQueuePacket(struct rt_rtmp_adapter *pAd, IN BOOLEAN bIntContext, u8 Q
 
 			/* probe the Queue Head */
 			pQueue = &pAd->TxSwQueue[QueIdx];
-			if ((pEntry = pQueue->Head) == NULL) {
+			pEntry = pQueue->Head;
+			if (pEntry == NULL) {
 				DEQUEUE_UNLOCK(&pAd->irq_lock, bIntContext,
 					       IrqFlags);
 				break;
@@ -824,7 +825,8 @@ void RTMPDeQueuePacket(struct rt_rtmp_adapter *pAd, IN BOOLEAN bIntContext, u8 Q
 				}
 
 				do {
-					if ((pEntry = pQueue->Head) == NULL)
+					pEntry = pQueue->Head;
+					if (pEntry == NULL)
 						break;
 
 					/* For TX_AMSDU_FRAME/TX_RALINK_FRAME, Need to check if next pakcet can do aggregation. */
drivers/staging/rt2860/common/cmm_wpa.c +8 -10
index 94e119f..c16f376 100644
@@ -2928,25 +2928,23 @@ void WpaShowAllsuite(u8 *rsnie, u32 rsnie_len)
 	hex_dump("RSNIE", rsnie, rsnie_len);
 
 	/* group cipher */
-	if ((pSuite =
-	     GetSuiteFromRSNIE(rsnie, rsnie_len, GROUP_SUITE,
-			       &count)) != NULL) {
+	pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, GROUP_SUITE, &count);
+	if (pSuite != NULL) {
 		hex_dump("group cipher", pSuite, 4 * count);
 	}
 	/* pairwise cipher */
-	if ((pSuite =
-	     GetSuiteFromRSNIE(rsnie, rsnie_len, PAIRWISE_SUITE,
-			       &count)) != NULL) {
+	pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PAIRWISE_SUITE, &count);
+	if (pSuite != NULL) {
 		hex_dump("pairwise cipher", pSuite, 4 * count);
 	}
 	/* AKM */
-	if ((pSuite =
-	     GetSuiteFromRSNIE(rsnie, rsnie_len, AKM_SUITE, &count)) != NULL) {
+	pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, AKM_SUITE, &count);
+	if (pSuite != NULL) {
 		hex_dump("AKM suite", pSuite, 4 * count);
 	}
 	/* PMKID */
-	if ((pSuite =
-	     GetSuiteFromRSNIE(rsnie, rsnie_len, PMKID_LIST, &count)) != NULL) {
+	pSuite = GetSuiteFromRSNIE(rsnie, rsnie_len, PMKID_LIST, &count);
+	if (pSuite != NULL) {
 		hex_dump("PMKID", pSuite, LEN_PMKID);
 	}
 
drivers/staging/rt2860/common/spectrum.c +4 -3
index 51e38d8..2d5f847 100644
@@ -1900,8 +1900,8 @@ static void PeerMeasureReportAction(struct rt_rtmp_adapter *pAd,
 /*      if (pAd->CommonCfg.bIEEE80211H != TRUE) */
 /*              return; */
 
-	if ((pMeasureReportInfo =
-	     kmalloc(sizeof(struct rt_measure_rpi_report), GFP_ATOMIC)) == NULL) {
+	pMeasureReportInfo = kmalloc(sizeof(struct rt_measure_rpi_report), GFP_ATOMIC);
+	if (pMeasureReportInfo == NULL) {
 		DBGPRINT(RT_DEBUG_ERROR,
 			 ("%s unable to alloc memory for measure report buffer (size=%zu).\n",
 			  __func__, sizeof(struct rt_measure_rpi_report)));
@@ -2016,7 +2016,8 @@ static void PeerTpcRepAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_e
 	NdisZeroMemory(&TpcRepInfo, sizeof(struct rt_tpc_report_info));
 	if (PeerTpcRepSanity
 	    (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &TpcRepInfo)) {
-		if ((pEntry = TpcReqLookUp(pAd, DialogToken)) != NULL) {
+		pEntry = TpcReqLookUp(pAd, DialogToken);
+		if (pEntry != NULL) {
 			TpcReqDelete(pAd, pEntry->DialogToken);
 			DBGPRINT(RT_DEBUG_TRACE,
 				 ("%s: DialogToken=%x, TxPwr=%d, LinkMargin=%d\n",
drivers/staging/rt2860/pci_main_dev.c +4 -2
index 6af4304..4271bcd 100644
@@ -280,7 +280,8 @@ static int __devinit rt2860_probe(IN struct pci_dev *pci_dev,
 
 /*PCIDevInit============================================== */
 	/* wake up and enable device */
-	if ((rv = pci_enable_device(pci_dev)) != 0) {
+	rv = pci_enable_device(pci_dev);
+	if (rv != 0) {
 		DBGPRINT(RT_DEBUG_ERROR,
 			 ("Enable PCI device failed, errno=%d!\n", rv));
 		return rv;
@@ -288,7 +289,8 @@ static int __devinit rt2860_probe(IN struct pci_dev *pci_dev,
 
 	print_name = (char *)pci_name(pci_dev);
 
-	if ((rv = pci_request_regions(pci_dev, print_name)) != 0) {
+	rv = pci_request_regions(pci_dev, print_name);
+	if (rv != 0) {
 		DBGPRINT(RT_DEBUG_ERROR,
 			 ("Request PCI resource failed, errno=%d!\n", rv));
 		goto err_out;
drivers/staging/rt2860/rt_linux.c +4 -3
index b5c78ae..b5214eb 100644
@@ -462,8 +462,8 @@ void *duplicate_pkt(struct rt_rtmp_adapter *pAd,
 	struct sk_buff *skb;
 	void *pPacket = NULL;
 
-	if ((skb =
-	     __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG)) != NULL) {
+	skb = __dev_alloc_skb(HdrLen + DataSize + 2, MEM_ALLOC_FLAG);
+	if (skb != NULL) {
 		skb_reserve(skb, 2);
 		NdisMoveMemory(skb_tail_pointer(skb), pHeader802_3, HdrLen);
 		skb_put(skb, HdrLen);
@@ -672,7 +672,8 @@ void RTMPSendWirelessEvent(struct rt_rtmp_adapter *pAd,
 		return;
 	}
 	/*Allocate memory and copy the msg. */
-	if ((pBuf = kmalloc(IW_CUSTOM_MAX_LEN, GFP_ATOMIC)) != NULL) {
+	pBuf = kmalloc(IW_CUSTOM_MAX_LEN, GFP_ATOMIC);
+	if (pBuf != NULL) {
 		/*Prepare the payload */
 		memset(pBuf, 0, IW_CUSTOM_MAX_LEN);
 
Signature · 1 line
1.7.0.14.g7e948
#7 lore raw

PATCH 6/13 drivers/staging/rt2870: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/rt2870/common/rtusb_bulk.c |   15 ++++++++++-----
 drivers/staging/rt2870/common/rtusb_io.c   |   10 +++++-----
 2 files changed, 15 insertions(+), 10 deletions(-)
drivers/staging/rt2870/common/rtusb_bulk.c +10 -5
index 379780c..23e52ff 100644
@@ -475,7 +475,8 @@ void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter *pAd,
 			  (usb_complete_t) RTUSBBulkOutDataPacketComplete);
 
 	pUrb = pHTTXContext->pUrb;
-	if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) {
+	ret = RTUSB_SUBMIT_URB(pUrb);
+	if (ret != 0) {
 		DBGPRINT(RT_DEBUG_ERROR,
 			 ("RTUSBBulkOutDataPacket: Submit Tx URB failed %d\n",
 			  ret));
@@ -573,7 +574,8 @@ void RTUSBBulkOutNullFrame(struct rt_rtmp_adapter *pAd)
 			(usb_complete_t) RTUSBBulkOutNullFrameComplete);
 
 	pUrb = pNullContext->pUrb;
-	if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) {
+	ret = RTUSB_SUBMIT_URB(pUrb);
+	if (ret != 0) {
 		RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags);
 		pAd->BulkOutPending[0] = FALSE;
 		pAd->watchDogTxPendingCnt[0] = 0;
@@ -667,7 +669,8 @@ void RTUSBBulkOutMLMEPacket(struct rt_rtmp_adapter *pAd, u8 Index)
 	pUrb->transfer_flags &= (~URB_NO_TRANSFER_DMA_MAP);
 
 	pUrb = pMLMEContext->pUrb;
-	if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) {
+	ret = RTUSB_SUBMIT_URB(pUrb);
+	if (ret != 0) {
 		DBGPRINT(RT_DEBUG_ERROR,
 			 ("RTUSBBulkOutMLMEPacket: Submit MLME URB failed %d\n",
 			  ret));
@@ -742,7 +745,8 @@ void RTUSBBulkOutPsPoll(struct rt_rtmp_adapter *pAd)
 			(usb_complete_t) RTUSBBulkOutPsPollComplete);
 
 	pUrb = pPsPollContext->pUrb;
-	if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) {
+	ret = RTUSB_SUBMIT_URB(pUrb);
+	if (ret != 0) {
 		RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags);
 		pAd->BulkOutPending[0] = FALSE;
 		pAd->watchDogTxPendingCnt[0] = 0;
@@ -799,7 +803,8 @@ void DoBulkIn(struct rt_rtmp_adapter *pAd)
 	RTUSBInitRxDesc(pAd, pRxContext);
 
 	pUrb = pRxContext->pUrb;
-	if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) {	/* fail */
+	ret = RTUSB_SUBMIT_URB(pUrb);
+	if (ret != 0) {	/* fail */
 
 		RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
 		pRxContext->InUse = FALSE;
drivers/staging/rt2870/common/rtusb_io.c +5 -5
index cf0d2f5..f0b6972 100644
@@ -1169,11 +1169,10 @@ void CMDHandler(struct rt_rtmp_adapter *pAd)
 								     (usb_complete_t)
 								     RTUSBBulkOutDataPacketComplete);
 
-								if ((ret =
-								     RTUSB_SUBMIT_URB
+								ret = RTUSB_SUBMIT_URB
 								     (pHTTXContext->
-								      pUrb)) !=
-								    0) {
+								      pUrb);
+								if (ret != 0) {
 									RTMP_INT_LOCK
 									    (&pAd->
 									     BulkOutLock
@@ -1545,7 +1544,8 @@ void CMDHandler(struct rt_rtmp_adapter *pAd)
 							RTUSBInitRxDesc(pAd,
 									pRxContext);
 							pUrb = pRxContext->pUrb;
-							if ((ret = RTUSB_SUBMIT_URB(pUrb)) != 0) {	/* fail */
+							ret = RTUSB_SUBMIT_URB(pUrb);
+							if (ret != 0) {	/* fail */
 
 								RTMP_IRQ_LOCK
 								    (&pAd->
Signature · 1 line
1.7.0.14.g7e948
#8 lore raw

PATCH 7/13 drivers/staging/rtl8187se: Hoist assign from if

In reply to Joe Perches
---
 .../rtl8187se/ieee80211/ieee80211_softmac.c        |    3 ++-
 drivers/staging/rtl8187se/r8180_core.c             |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +2 -1
index c2f472e..1f858f8 100644
@@ -1554,7 +1554,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {
 		ieee80211_resp_to_auth(ieee, status, dest);
 	}
 	//DMESG("Dest is "MACSTR, MAC2STR(dest));
drivers/staging/rtl8187se/r8180_core.c +4 -2
index b1757ac..4fb2c05 100644
@@ -402,7 +402,8 @@ short buffer_add(struct buffer **buffer, u32 *buf, dma_addr_t dma,
 	tmp=*buffer;
 
 	while(tmp->next!=(*buffer)) tmp=tmp->next;
-	if ((tmp->next= kmalloc(sizeof(struct buffer),GFP_KERNEL)) == NULL){
+	tmp->next = kmalloc(sizeof(struct buffer),GFP_KERNEL);
+	if (tmp->next == NULL) {
 		DMESGE("Failed to kmalloc TX/RX struct");
 		return -1;
 	}
@@ -1154,7 +1155,8 @@ short alloc_rx_desc_ring(struct net_device *dev, u16 bufsize, int count)
 	tmp=desc;
 
 	for (i = 0; i < count; i++) {
-		if ((buf= kmalloc(bufsize * sizeof(u8),GFP_ATOMIC)) == NULL){
+		buf = kmalloc(bufsize * sizeof(u8),GFP_ATOMIC);
+		if (buf == NULL) {
 			DMESGE("Failed to kmalloc RX buffer");
 			return -1;
 		}
Signature · 1 line
1.7.0.14.g7e948
#9 lore raw

Re: [PATCH 07/13] drivers/staging/rtl8187se: Hoist assign from if

drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1558

Quoted 9 lines · Joe Perches
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +2 -1
@@ -1554,7 +1554,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

Careful that you don't add new coding style issues to a staging driver :)

I've fixed this up in the patch...

thanks,

greg k-h

#10 lore raw

PATCH 8/13 drivers/staging/rtl8192e: Hoist assign from if

In reply to Joe Perches
---
 .../staging/rtl8192e/ieee80211/ieee80211_softmac.c |    3 ++-
 drivers/staging/rtl8192e/r8192E_core.c             |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c +2 -1
index ea96c49..f6dfa99 100644
@@ -1933,7 +1933,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {
 		ieee80211_resp_to_auth(ieee, status, dest);
 	}
 	//DMESG("Dest is "MACSTR, MAC2STR(dest));
drivers/staging/rtl8192e/r8192E_core.c +4 -2
index 886105d..1f37978 100644
@@ -1863,13 +1863,15 @@ static short rtl8192_pci_initdescring(struct net_device *dev)
 
     /* general process for other queue */
     for (i = 0; i < MAX_TX_QUEUE_COUNT; i++) {
-        if ((ret = rtl8192_alloc_tx_desc_ring(dev, i, priv->txringcount)))
+        ret = rtl8192_alloc_tx_desc_ring(dev, i, priv->txringcount);
+        if (ret)
             goto err_free_rings;
     }
 
 #if 0
     /* specific process for hardware beacon process */
-    if ((ret = rtl8192_alloc_tx_desc_ring(dev, MAX_TX_QUEUE_COUNT - 1, 2)))
+    ret = rtl8192_alloc_tx_desc_ring(dev, MAX_TX_QUEUE_COUNT - 1, 2);
+    if (ret)
         goto err_free_rings;
 #endif
 
Signature · 1 line
1.7.0.14.g7e948
#11 lore raw

Re: [PATCH 08/13] drivers/staging/rtl8192e: Hoist assign from if

drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1937

Quoted 9 lines · Joe Perches
drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c +2 -1
@@ -1933,7 +1933,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

Same problem...

#12 lore raw

PATCH 9/13 drivers/staging/rtl8192su: Hoist assign from if

In reply to Joe Perches
---
 .../rtl8192su/ieee80211/ieee80211_softmac.c        |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +2 -1
index 9d8cb0e..76e7fb3 100644
@@ -1690,7 +1690,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {
 		ieee80211_resp_to_auth(ieee, status, dest);
 	}
 	//DMESG("Dest is "MACSTR, MAC2STR(dest));
Signature · 1 line
1.7.0.14.g7e948
#13 lore raw

Re: [PATCH 09/13] drivers/staging/rtl8192su: Hoist assign from if

drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1694

Quoted 9 lines · Joe Perches
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +2 -1
@@ -1690,7 +1690,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

And again. Did you do this with some tool and not by hand?

Did you not run your patch through checkpatch after creating it and before sending it to me?

thanks,

greg k-h

#14 lore raw

Re: [PATCH 09/13] drivers/staging/rtl8192su: Hoist assign from if

Quoted 7 lines · Greg KH
Quoted 6 lines · Joe Perches
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +0 -0
@@ -1690,7 +1690,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
Quoted 5 lines

drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1694

Quoted 3 lines
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +2 -1
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

And again. Did you do this with some tool and not by hand?

[]

Quoted 4 lines

Did you not run your patch through checkpatch after creating it and before sending it to me?

From the original 0/13 introduction:

http://lkml.org/lkml/2010/3/25/6

Used scripts/cvt_kernel.style.pl:
--convert-hoist_assigns_from_if
and verified visually.

checkpatch errors ignored

The script itself is:
http://lkml.org/lkml/2010/3/24/447

Quoted 3 lines

From an earlier Greg KH email:

Careful that you don't add new coding style issues to a staging driver

Avoiding checkpatch errors and avoiding new coding style issues are frequently conflicting goals.

I try not to add "new" issues. and I generally
leave the old ones alone.

I don't use checkpatch as a guide for what to fix
or as an inhibitor on what style patch to send.

#15 lore raw

Re: [PATCH 09/13] drivers/staging/rtl8192su: Hoist assign from if

Quoted 20 lines · Joe Perches
Quoted 7 lines · Greg KH
Quoted 6 lines · Joe Perches
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +0 -0
@@ -1690,7 +1690,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
Quoted 5 lines

drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1694

Quoted 3 lines
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +2 -1
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

And again. Did you do this with some tool and not by hand?

[]

Quoted 4 lines

Did you not run your patch through checkpatch after creating it and before sending it to me?

From the original 0/13 introduction:

http://lkml.org/lkml/2010/3/25/6

Quoted 8 lines

Used scripts/cvt_kernel.style.pl:
--convert-hoist_assigns_from_if
and verified visually.

checkpatch errors ignored

The script itself is:
http://lkml.org/lkml/2010/3/24/447

And this points out why I hate scripts.

It is _trivial_ to fix up the obvious formatting problem, on the same line that you are modifying, when doing so.

Oh well, I did it by hand for you...

thanks,

greg k-h

#16 lore raw

Re: [PATCH 09/13] drivers/staging/rtl8192su: Hoist assign from if

Quoted 27 lines · Greg KH
Quoted 26 lines · Joe Perches
Quoted 7 lines · Greg KH
Quoted 6 lines · Joe Perches
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +0 -0
@@ -1690,7 +1690,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
Quoted 5 lines

drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1694

Quoted 3 lines
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +2 -1
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

And again. Did you do this with some tool and not by hand?

[]

Quoted 4 lines

Did you not run your patch through checkpatch after creating it and before sending it to me?

From the original 0/13 introduction:

http://lkml.org/lkml/2010/3/25/6

Used scripts/cvt_kernel.style.pl:
--convert-hoist_assigns_from_if
and verified visually.

checkpatch errors ignored

Quoted 7 lines
Quoted 2 lines

The script itself is:
http://lkml.org/lkml/2010/3/24/447

And this points out why I hate scripts.

It is _trivial_ to fix up the obvious formatting problem, on the same line that you are modifying, when doing so.

Define _trivial_ and define obvious.

Here you've multiple situations of initial line spacing not using tabs, odd use of parentheses in the original style, compressed logical tests or assigns, etc.

All trivially fixable, but not necessarily correct to do in a single pass.

If you do them in a single pass, you run into your "do too much in a single patch" argument.

cheers, Joe

#17 lore raw

Re: [PATCH 09/13] drivers/staging/rtl8192su: Hoist assign from if

Quoted 31 lines · Joe Perches
Quoted 30 lines · Greg KH
Quoted 28 lines · Joe Perches
Quoted 7 lines · Greg KH
Quoted 6 lines · Joe Perches
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +0 -0
@@ -1690,7 +1690,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
Quoted 5 lines

drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1694

Quoted 3 lines
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +2 -1
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

And again. Did you do this with some tool and not by hand?

[]

Quoted 4 lines

Did you not run your patch through checkpatch after creating it and before sending it to me?

From the original 0/13 introduction:

http://lkml.org/lkml/2010/3/25/6

Used scripts/cvt_kernel.style.pl:
--convert-hoist_assigns_from_if
and verified visually.

checkpatch errors ignored

The script itself is:
http://lkml.org/lkml/2010/3/24/447

Quoted 6 lines
Quoted 4 lines

And this points out why I hate scripts.

It is _trivial_ to fix up the obvious formatting problem, on the same line that you are modifying, when doing so.

Define _trivial_ and define obvious.

"I know it when I see it."

#18 lore raw

Re: [PATCH 09/13] drivers/staging/rtl8192su: Hoist assign from if

Quoted 2 lines · Greg KH
Quoted 1 line

Define _trivial_ and define obvious.

"I know it when I see it."

As do I.

It wasn't an autoscript only process.

I inspected all of those hoist patches before sending them modified some and decided not to modify others.

#19 lore raw

PATCH 10/13 drivers/staging/rtl8192u: Hoist assign from if

In reply to Joe Perches
---
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +2 -1
index 27d9257..01e56f6 100644
@@ -1712,7 +1712,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {
 		ieee80211_resp_to_auth(ieee, status, dest);
 	}
 	//DMESG("Dest is "MACSTR, MAC2STR(dest));
Signature · 1 line
1.7.0.14.g7e948
#20 lore raw

Re: [PATCH 10/13] drivers/staging/rtl8192u: Hoist assign from if

Quoted 11 lines · Joe Perches
---
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
index 27d9257..01e56f6 100644

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) · line 1716

Quoted 6 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +2 -1
@@ -1712,7 +1712,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
 
-	if ((status = auth_rq_parse(skb, dest))!= -1){
+	status = auth_rq_parse(skb, dest);
+	if (status!= -1) {

again...

#21 lore raw

PATCH 11/13 drivers/staging/vt6655: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/vt6655/desc.h        |    6 ++++--
 drivers/staging/vt6655/device.h      |    6 ++++--
 drivers/staging/vt6655/device_main.c |    3 ++-
 drivers/staging/vt6655/iwctl.c       |    3 ++-
 4 files changed, 12 insertions(+), 6 deletions(-)
drivers/staging/vt6655/desc.h +4 -2
index b573ef7..78c863a 100644
@@ -232,7 +232,8 @@ typedef struct tagDEVICE_RD_INFO {
 /*
 static inline PDEVICE_RD_INFO alloc_rd_info(void) {
     PDEVICE_RD_INFO  ptr;
-    if ((ptr = kmalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC)) == NULL)
+    ptr = kmalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
+    if (ptr == NULL)
         return NULL;
     else {
         memset(ptr,0,sizeof(DEVICE_RD_INFO));
@@ -361,7 +362,8 @@ typedef struct tagDEVICE_TD_INFO{
 /*
 static inline PDEVICE_TD_INFO alloc_td_info(void) {
     PDEVICE_TD_INFO  ptr;
-    if ((ptr = kmalloc(sizeof(DEVICE_TD_INFO),GFP_ATOMIC))==NULL)
+    ptr = kmalloc(sizeof(DEVICE_TD_INFO),GFP_ATOMIC);
+    if (ptr==NULL)
         return NULL;
     else {
         memset(ptr,0,sizeof(DEVICE_TD_INFO));
drivers/staging/vt6655/device.h +4 -2
index cde44d2..7a9f406 100644
@@ -898,7 +898,8 @@ inline static BOOL device_get_ip(PSDevice pInfo) {
 
 static inline PDEVICE_RD_INFO alloc_rd_info(void) {
     PDEVICE_RD_INFO  ptr;
-    if ((ptr = (PDEVICE_RD_INFO)kmalloc((int)sizeof(DEVICE_RD_INFO), (int)GFP_ATOMIC)) == NULL)
+    ptr = (PDEVICE_RD_INFO)kmalloc((int)sizeof(DEVICE_RD_INFO), (int)GFP_ATOMIC);
+    if (ptr == NULL)
         return NULL;
     else {
         memset(ptr,0,sizeof(DEVICE_RD_INFO));
@@ -908,7 +909,8 @@ static inline PDEVICE_RD_INFO alloc_rd_info(void) {
 
 static inline PDEVICE_TD_INFO alloc_td_info(void) {
     PDEVICE_TD_INFO  ptr;
-    if ((ptr = (PDEVICE_TD_INFO)kmalloc((int)sizeof(DEVICE_TD_INFO), (int)GFP_ATOMIC))==NULL)
+    ptr = (PDEVICE_TD_INFO)kmalloc((int)sizeof(DEVICE_TD_INFO), (int)GFP_ATOMIC);
+    if (ptr == NULL)
         return NULL;
     else {
         memset(ptr,0,sizeof(DEVICE_TD_INFO));
drivers/staging/vt6655/device_main.c +2 -1
index 1d64365..66fe7ba 100644
@@ -637,7 +637,8 @@ byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
 //2008-8-4 <add> by chester
 //zonetype initial
  pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
- if((zonetype=Config_FileOperation(pDevice,FALSE,NULL)) >= 0) {         //read zonetype file ok!
+ zonetype = Config_FileOperation(pDevice,FALSE,NULL);
+ if (zonetype >= 0) {         //read zonetype file ok!
   if ((zonetype == 0)&&
         (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){          //for USA
     pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
drivers/staging/vt6655/iwctl.c +2 -1
index 78b4983..2f26c6d 100644
@@ -1702,7 +1702,8 @@ int iwctl_giwpower(struct net_device *dev,
     DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
 
 
-	if ((wrq->disabled = (mode == WMAC_POWER_CAM)))
+	wrq->disabled = (mode == WMAC_POWER_CAM);
+	if (wrq->disabled)
 	    return 0;
 
 	if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
Signature · 1 line
1.7.0.14.g7e948
#22 lore raw

Re: [PATCH 11/13] drivers/staging/vt6655: Hoist assign from if

drivers/staging/vt6655/desc.h typedef struct tagDEVICE_TD_INFO{ · line 366

Quoted 7 lines · Joe Perches
drivers/staging/vt6655/desc.h +2 -1
@@ -361,7 +362,8 @@ typedef struct tagDEVICE_TD_INFO{
 /*
 static inline PDEVICE_TD_INFO alloc_td_info(void) {
     PDEVICE_TD_INFO  ptr;
-    if ((ptr = kmalloc(sizeof(DEVICE_TD_INFO),GFP_ATOMIC))==NULL)
+    ptr = kmalloc(sizeof(DEVICE_TD_INFO),GFP_ATOMIC);
+    if (ptr==NULL)

Same issue again...

#23 lore raw

PATCH 12/13 drivers/staging/vt6656: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/vt6656/main_usb.c |   12 ++++++++----
 drivers/staging/vt6656/usbpipe.c  |   21 ++++++++++++++-------
 2 files changed, 22 insertions(+), 11 deletions(-)
drivers/staging/vt6656/main_usb.c +8 -4
index a8e1adb..f15e7b4 100644
@@ -1434,7 +1434,8 @@ static int Config_FileGetParameter(UCHAR *string, UCHAR *dest,UCHAR *source)
     source+=strlen(buf1);
 
 //find target string start point
-    if((start_p = kstrstr(source,buf1))==NULL)
+    start_p = kstrstr(source,buf1);
+    if (start_p == NULL)
 	return FALSE;
 
 //check if current config line is marked by "#" ??
@@ -1446,7 +1447,8 @@ for(ii=1;;ii++) {
 }
 
 //find target string end point
-     if((end_p = kstrstr(start_p,"\n"))==NULL) {       //cann't find "\n",but don't care
+     end_p = kstrstr(start_p,"\n");
+     if (end_p == NULL) {       //can't find "\n",but don't care
           end_p=start_p+strlen(start_p);   //no include "\n"
        }
 
@@ -1455,7 +1457,8 @@ for(ii=1;;ii++) {
    buf2[end_p-start_p]='\0';
 
    //find value
-   if((start_p = kstrstr(buf2,"="))==NULL)
+   start_p = kstrstr(buf2,"=");
+   if (start_p == NULL)
       return FALSE;
    memset(buf1,0,100);
    strcpy(buf1,start_p+1);
@@ -1548,7 +1551,8 @@ static int Read_config_file(PSDevice pDevice) {
  pDevice->config_file.eAuthenMode = -1;
  pDevice->config_file.eEncryptionStatus = -1;
 
-  if((buffer=Config_FileOperation(pDevice)) ==NULL) {
+  buffer = Config_FileOperation(pDevice);
+  if (buffer == NULL) {
      result =-1;
      return result;
   }
drivers/staging/vt6656/usbpipe.c +14 -7
index 65e91a3..df874ff 100644
@@ -193,7 +193,8 @@ PIPEnsControlOut(
 			 usb_sndctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest,
 			 pbyBuffer, wLength, s_nsControlInUsbIoCompleteWrite, pDevice);
 
-	if ((ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC)) != 0) {
+	ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
+	if (ntStatus != 0) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission failed: %d\n", ntStatus);
 		return STATUS_FAILURE;
 	}
@@ -251,7 +252,8 @@ PIPEnsControlIn(
 			 usb_rcvctrlpipe(pDevice->usb , 0), (char *) &pDevice->sUsbCtlRequest,
 			 pbyBuffer, wLength, s_nsControlInUsbIoCompleteRead, pDevice);
 
-	if ((ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC)) != 0) {
+	ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
+	if (ntStatus != 0) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control request submission failed: %d\n", ntStatus);
 	}else {
 		MP_SET_FLAG(pDevice, fMP_CONTROL_READS);
@@ -414,7 +416,8 @@ usb_fill_bulk_urb(pDevice->pInterruptURB,
 #endif
 #endif
 
-	if ((ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC)) != 0) {
+	ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC);
+	if (ntStatus != 0) {
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus);
     }
 
@@ -494,7 +497,8 @@ s_nsInterruptUsbIoCompleteRead(
 
     if (pDevice->fKillEventPollingThread != TRUE) {
    #if 0               //reserve int URB submit
-	if ((ntStatus = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
+	ntStatus = usb_submit_urb(urb, GFP_ATOMIC);
+	if (ntStatus != 0) {
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Re-Submit int URB failed %d\n", ntStatus);
     }
    #else                                                                                     //replace int URB submit by bulk transfer
@@ -507,7 +511,8 @@ s_nsInterruptUsbIoCompleteRead(
 		     s_nsInterruptUsbIoCompleteRead,
 		     pDevice);
 
-	if ((ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC)) != 0) {
+	ntStatus = usb_submit_urb(pDevice->pInterruptURB, GFP_ATOMIC);
+	if (ntStatus != 0) {
 	    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit int URB failed %d\n", ntStatus);
            }
 
@@ -572,7 +577,8 @@ PIPEnsBulkInUsbRead(
 		s_nsBulkInUsbIoCompleteRead,
 		pRCB);
 
-	if((ntStatus = usb_submit_urb(pUrb, GFP_ATOMIC)) != 0){
+	ntStatus = usb_submit_urb(pUrb, GFP_ATOMIC);
+	if (ntStatus != 0) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Rx URB failed %d\n", ntStatus);
 		return STATUS_FAILURE ;
 	}
@@ -718,7 +724,8 @@ PIPEnsSendBulkOut(
         		s_nsBulkOutIoCompleteWrite,
         		pContext);
 
-    	if((status = usb_submit_urb(pUrb, GFP_ATOMIC))!=0)
+    	status = usb_submit_urb(pUrb, GFP_ATOMIC);
+    	if (status!=0)
     	{
     		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Tx URB failed %d\n", status);
     		return STATUS_FAILURE;
Signature · 1 line
1.7.0.14.g7e948
#24 lore raw

Re: [PATCH 12/13] drivers/staging/vt6656: Hoist assign from if

drivers/staging/vt6656/usbpipe.c PIPEnsSendBulkOut( · line 728

Quoted 7 lines · Joe Perches
drivers/staging/vt6656/usbpipe.c +2 -1
@@ -718,7 +724,8 @@ PIPEnsSendBulkOut(
         		s_nsBulkOutIoCompleteWrite,
         		pContext);
 
-    	if((status = usb_submit_urb(pUrb, GFP_ATOMIC))!=0)
+    	status = usb_submit_urb(pUrb, GFP_ATOMIC);
+    	if (status!=0)

And again...

#25 lore raw

PATCH 13/13 drivers/staging/wlags49_h2: Hoist assign from if

In reply to Joe Perches
---
 drivers/staging/wlags49_h2/hcf.c       |   15 ++++++++++-----
 drivers/staging/wlags49_h2/wl_main.c   |    3 ++-
 drivers/staging/wlags49_h2/wl_netdev.c |   12 ++++++++----
 drivers/staging/wlags49_h2/wl_priv.c   |    9 ++++++---
 drivers/staging/wlags49_h2/wl_sysfs.c  |    3 ++-
 5 files changed, 28 insertions(+), 14 deletions(-)
drivers/staging/wlags49_h2/hcf.c +10 -5
index 6e39f50..390628c 100644
@@ -990,7 +990,8 @@ int	rc = HCF_ERR_INCOMP_FW;
 			ifbp->IFB_CntlOpt |= DMA_ENABLED;
 			HCFASSERT( NT_ASSERT, NEVER_TESTED )
 			// make the entire rx descriptor chain DMA-owned, so the DMA engine can (re-)use it.
-			if ( ( p = ifbp->IFB_FirstDesc[DMA_RX] ) != NULL ) {   //;? Think this over again in the light of the new chaining strategy
+			p = ifbp->IFB_FirstDesc[DMA_RX];
+			if (p != NULL) {   //;? Think this over again in the light of the new chaining strategy
 				if ( 1 ) 	{ //begin alternative
 					HCFASSERT( NT_ASSERT, NEVER_TESTED )
 					put_frame_lst( ifbp, ifbp->IFB_FirstDesc[DMA_RX], DMA_RX );
@@ -2087,7 +2088,8 @@ wci_bufp	pt;					//pointer with the "right" type, just to help ease writing macr
 			OPW( HREG_AUX_OFFSET, (hcf_16)(PLUG_DATA_OFFSET & 0x7E) );
 			io_port = ifbp->IFB_IOBase + HREG_AUX_DATA;		//to prevent side effects of the MSF-defined macro
 			p = ltvp->val;					//destination char pointer (in LTV record)
-			if ( ( i = len - 1 ) > 0 ) {
+			i = len - 1;
+			if (i > 0 ) {
 				pt = (wci_bufp)p;	//just to help ease writing macros with embedded assembly
 				IN_PORT_STRING_8_16( io_port, pt, i ); //space used by T: -1
 			}
@@ -2674,7 +2676,8 @@ hcf_16		fid = 0;
 
 #if (HCF_EXT) & HCF_EXT_TX_CONT				// Continuous transmit test
 	if ( tx_cntl == HFS_TX_CNTL_TX_CONT ) {
-	 	if ( ( fid = get_fid( ifbp ) ) != 0 ) {
+	 	fid = get_fid(ifbp);
+	 	if (fid != 0 ) {
 											//setup BAP to begin of TxFS
 			(void)setup_bap( ifbp, fid, 0, IO_OUT );
 											//copy all the fragments in a transparent fashion
@@ -2700,7 +2703,8 @@ hcf_16		fid = 0;
 #if (HCF_TYPE) & HCF_TYPE_WPA
 	tx_cntl |= ifbp->IFB_MICTxCntl;
 #endif // HCF_TYPE_WPA
-	if ( (fid = ifbp->IFB_TxFID) == 0 && ( fid = get_fid( ifbp ) ) != 0 ) 		/* 4 */
+	fid = ifbp->IFB_TxFID;
+	if (fid == 0 && ( fid = get_fid( ifbp ) ) != 0 ) 		/* 4 */
 			/* skip the next compound statement if:
 			   - pre-put message or
 			   - no fid available (which should never occur if the MSF adheres to the WCI)
@@ -4860,7 +4864,8 @@ PROT_CNT_INI
 int	rc;
 
 	HCFTRACE( ifbp, HCF_TRACE_STRIO );
-	if ( ( rc = ifbp->IFB_DefunctStat ) == HCF_SUCCESS ) {										/*2*/
+	rc = ifbp->IFB_DefunctStat;
+	if (rc == HCF_SUCCESS) {										/*2*/
 		OPW( HREG_SELECT_1, fid );																/*4*/
 		OPW( HREG_OFFSET_1, offset );
 		if ( type == IO_IN ) {
drivers/staging/wlags49_h2/wl_main.c +2 -1
index cf0c384..88d0d47 100644
@@ -3591,7 +3591,8 @@ int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof,
 
     len=0;
 
-	if ( ( lp = ((struct net_device *)data)->priv ) == NULL ) {
+	lp = ((struct net_device *)data)->priv;
+	if (lp == NULL) {
         len += sprintf(buf+len,"No wl_private in scull_read_procmem\n" );
 	} else if ( lp->wlags49_type == 0 ){
    	    ifbp = &lp->hcfCtx;
drivers/staging/wlags49_h2/wl_netdev.c +8 -4
index fa082d9..0999c71 100644
@@ -929,8 +929,10 @@ int wl_rx(struct net_device *dev)
         port = ( hfs_stat >> 8 ) & 0x0007;
         DBG_RX( DbgInfo, "Rx frame for port %d\n", port );
 
-        if(( pktlen = lp->hcfCtx.IFB_RxLen ) != 0 ) {
-            if(( skb = ALLOC_SKB( pktlen )) != NULL ) {
+        pktlen = lp->hcfCtx.IFB_RxLen;
+        if (pktlen != 0) {
+            skb = ALLOC_SKB(pktlen);
+            if (skb != NULL) {
                 /* Set the netdev based on the port */
                 switch( port ) {
 #ifdef USE_WDS
@@ -1994,8 +1996,10 @@ int wl_rx_dma( struct net_device *dev )
                 port = ( hfs_stat >> 8 ) & 0x0007;
                 DBG_RX( DbgInfo, "Rx frame for port %d\n", port );
 
-                if(( pktlen = GET_BUF_CNT( desc_next )) != 0 ) {
-                    if(( skb = ALLOC_SKB( pktlen )) != NULL ) {
+                pktlen = GET_BUF_CNT(desc_next);
+                if (pktlen != 0) {
+                    skb = ALLOC_SKB(pktlen);
+                    if (skb != NULL) {
                         switch( port ) {
 #ifdef USE_WDS
                         case 1:
drivers/staging/wlags49_h2/wl_priv.c +6 -3
index ee610c7..3cfa18a 100644
@@ -502,7 +502,8 @@ int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp )
 						return result;
 					}
 
-					if ((data = kmalloc(urq->len, GFP_KERNEL)) != NULL) {
+					data = kmalloc(urq->len, GFP_KERNEL);
+					if (data != NULL) {
 						memset( Descp, 0, sizeof( DESC_STRCT ));
 						memcpy( data, urq->data, urq->len );
 
@@ -616,7 +617,8 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp )
 				   LTV record, try to allocate it from the kernel stack.
 				   Otherwise, we just use our local LTV record. */
 				if( urq->len > sizeof( lp->ltvRecord )) {
-					if(( pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL )) != NULL ) {
+					pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL );
+					if (pLtv != NULL) {
 						ltvAllocated = TRUE;
 					} else {
 						DBG_ERROR( DbgInfo, "Alloc FAILED\n" );
@@ -1295,7 +1297,8 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp )
 				   LTV record, try to allocate it from the kernel stack.
 				   Otherwise, we just use our local LTV record. */
 				if( urq->len > sizeof( lp->ltvRecord )) {
-					if(( pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL )) != NULL ) {
+					pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL );
+					if (pLtv != NULL) {
 						ltvAllocated = TRUE;
 
 						/* Copy the command/length information into the new buffer. */
drivers/staging/wlags49_h2/wl_sysfs.c +2 -1
index 864e01a..e4c8804 100644
@@ -46,7 +46,8 @@ static ssize_t show_tallies(struct device *d, struct device_attribute *attr,
     if (dev_isalive(dev)) {
 	wl_lock(lp, &flags);
 
-	if ((ret = wl_get_tallies(lp, &tallies)) == 0) {
+	ret = wl_get_tallies(lp, &tallies);
+	if (ret == 0) {
 		wl_unlock(lp, &flags);
 		ret = snprintf(buf, PAGE_SIZE,
 		    "TxUnicastFrames:           %u\n"
Signature · 1 line
1.7.0.14.g7e948