summaryrefslogtreecommitdiff
path: root/drivers/staging/ft1000
diff options
context:
space:
mode:
authorKelley Nielsen <kelleynnn@gmail.com>2013-11-06 05:09:56 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-10 07:55:00 -0800
commita3220b89bd396ff5b83ede05d7925564d277a9ea (patch)
tree3feb71b3ce45459def8f5eb02f0a2fff149f0c7d /drivers/staging/ft1000
parent9a1261f317110e2b139a35fe7acf7fa04ca1bf97 (diff)
staging: ft1000: flatten nesting in dsp_broadcast_msg_id()
The function dsp_broadcast_msg_id() has four levels of nesting. Move the handling for failed allocation for *dpram_blk from the else block at the end to the block immediately following the test, reverse the sense of the test, and exit with an error code if the allocation fails. This eliminates descending into an if block if the allocation is successful. Move all lines inside the removed block one tab to the left, and join lines that will fall under the 80 char limit. Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ft1000')
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_hw.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 2f54c2a23fe7..c071f61d0b8f 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -1445,36 +1445,30 @@ static int dsp_broadcast_msg_id(struct ft1000_usb *dev)
&& (dev->app_info[i].NumOfMsg
< MAX_MSG_LIMIT)) {
pdpram_blk = ft1000_get_buffer(&freercvpool);
- if (pdpram_blk != NULL) {
- if (ft1000_receive_cmd(dev,
- pdpram_blk->pbuffer,
- MAX_CMD_SQSIZE)) {
- /* Put message into the
- * appropriate application block
- * */
- dev->app_info[i].nRxMsg++;
- spin_lock_irqsave(&free_buff_lock,
- flags);
- list_add_tail(&pdpram_blk->list,
- &dev->app_info[i]
- .app_sqlist);
- dev->app_info[i].NumOfMsg++;
- spin_unlock_irqrestore(&free_buff_lock,
- flags);
- wake_up_interruptible(&dev->app_info[i]
- .wait_dpram_msg);
- } else {
- dev->app_info[i].nRxMsgMiss++;
- ft1000_free_buffer(pdpram_blk,
- &freercvpool);
- DEBUG("pdpram_blk::ft1000_get_buffer NULL\n");
- return -1;
- }
- } else {
+ if (pdpram_blk == NULL) {
DEBUG("Out of memory in free receive command pool\n");
dev->app_info[i].nRxMsgMiss++;
return -1;
}
+ if (ft1000_receive_cmd(dev, pdpram_blk->pbuffer,
+ MAX_CMD_SQSIZE)) {
+ /* Put message into the
+ * appropriate application block
+ */
+ dev->app_info[i].nRxMsg++;
+ spin_lock_irqsave(&free_buff_lock, flags);
+ list_add_tail(&pdpram_blk->list,
+ &dev->app_info[i] .app_sqlist);
+ dev->app_info[i].NumOfMsg++;
+ spin_unlock_irqrestore(&free_buff_lock, flags);
+ wake_up_interruptible(&dev->app_info[i]
+ .wait_dpram_msg);
+ } else {
+ dev->app_info[i].nRxMsgMiss++;
+ ft1000_free_buffer(pdpram_blk, &freercvpool);
+ DEBUG("pdpram_blk::ft1000_get_buffer NULL\n");
+ return -1;
+ }
}
}
return 0;