Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Remove assignments in if-statements

Remove assignment in if-statements to be consistent with the coding
style.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>

authored by

Valentin Ilie and committed by
Johan Hedberg
a08b15e6 5981a882

+59 -35
+3 -4
drivers/bluetooth/ath3k.c
··· 180 180 } 181 181 182 182 memcpy(send_buf, firmware->data, 20); 183 - if ((err = usb_control_msg(udev, pipe, 184 - USB_REQ_DFU_DNLOAD, 185 - USB_TYPE_VENDOR, 0, 0, 186 - send_buf, 20, USB_CTRL_SET_TIMEOUT)) < 0) { 183 + err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR, 184 + 0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT); 185 + if (err < 0) { 187 186 BT_ERR("Can't change to loading configuration err"); 188 187 goto error; 189 188 }
+10 -4
drivers/bluetooth/bfusb.c
··· 131 131 132 132 BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len); 133 133 134 - if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) 135 - return -ENOMEM; 134 + if (!urb) { 135 + urb = usb_alloc_urb(0, GFP_ATOMIC); 136 + if (!urb) 137 + return -ENOMEM; 138 + } 136 139 137 140 pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); 138 141 ··· 221 218 222 219 BT_DBG("bfusb %p urb %p", data, urb); 223 220 224 - if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) 225 - return -ENOMEM; 221 + if (!urb) { 222 + urb = usb_alloc_urb(0, GFP_ATOMIC); 223 + if (!urb) 224 + return -ENOMEM; 225 + } 226 226 227 227 skb = bt_skb_alloc(size, GFP_ATOMIC); 228 228 if (!skb) {
+6 -3
drivers/bluetooth/bluecard_cs.c
··· 257 257 ready_bit = XMIT_BUF_ONE_READY; 258 258 } 259 259 260 - if (!(skb = skb_dequeue(&(info->txq)))) 260 + skb = skb_dequeue(&(info->txq)); 261 + if (!skb) 261 262 break; 262 263 263 264 if (bt_cb(skb)->pkt_type & 0x80) { ··· 392 391 if (info->rx_skb == NULL) { 393 392 info->rx_state = RECV_WAIT_PACKET_TYPE; 394 393 info->rx_count = 0; 395 - if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 394 + info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); 395 + if (!info->rx_skb) { 396 396 BT_ERR("Can't allocate mem for new packet"); 397 397 return; 398 398 } ··· 568 566 /* Ericsson baud rate command */ 569 567 unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 }; 570 568 571 - if (!(skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 569 + skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); 570 + if (!skb) { 572 571 BT_ERR("Can't allocate mem for new packet"); 573 572 return -1; 574 573 }
+4 -3
drivers/bluetooth/bt3c_cs.c
··· 193 193 if (!pcmcia_dev_present(info->p_dev)) 194 194 break; 195 195 196 - 197 - if (!(skb = skb_dequeue(&(info->txq)))) { 196 + skb = skb_dequeue(&(info->txq)); 197 + if (!skb) { 198 198 clear_bit(XMIT_SENDING, &(info->tx_state)); 199 199 break; 200 200 } ··· 238 238 if (info->rx_skb == NULL) { 239 239 info->rx_state = RECV_WAIT_PACKET_TYPE; 240 240 info->rx_count = 0; 241 - if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 241 + info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); 242 + if (!info->rx_skb) { 242 243 BT_ERR("Can't allocate mem for new packet"); 243 244 return; 244 245 }
+4 -2
drivers/bluetooth/btuart_cs.c
··· 149 149 if (!pcmcia_dev_present(info->p_dev)) 150 150 return; 151 151 152 - if (!(skb = skb_dequeue(&(info->txq)))) 152 + skb = skb_dequeue(&(info->txq)); 153 + if (!skb) 153 154 break; 154 155 155 156 /* Send frame */ ··· 191 190 if (info->rx_skb == NULL) { 192 191 info->rx_state = RECV_WAIT_PACKET_TYPE; 193 192 info->rx_count = 0; 194 - if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 193 + info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); 194 + if (!info->rx_skb) { 195 195 BT_ERR("Can't allocate mem for new packet"); 196 196 return; 197 197 }
+6 -3
drivers/bluetooth/dtl1_cs.c
··· 153 153 if (!pcmcia_dev_present(info->p_dev)) 154 154 return; 155 155 156 - if (!(skb = skb_dequeue(&(info->txq)))) 156 + skb = skb_dequeue(&(info->txq)); 157 + if (!skb) 157 158 break; 158 159 159 160 /* Send frame */ ··· 216 215 info->hdev->stat.byte_rx++; 217 216 218 217 /* Allocate packet */ 219 - if (info->rx_skb == NULL) 220 - if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 218 + if (info->rx_skb == NULL) { 219 + info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); 220 + if (!info->rx_skb) { 221 221 BT_ERR("Can't allocate mem for new packet"); 222 222 info->rx_state = RECV_WAIT_NSH; 223 223 info->rx_count = NSHL; 224 224 return; 225 225 } 226 + } 226 227 227 228 *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); 228 229 nsh = (nsh_t *)info->rx_skb->data;
+16 -11
drivers/bluetooth/hci_bcsp.c
··· 291 291 /* First of all, check for unreliable messages in the queue, 292 292 since they have priority */ 293 293 294 - if ((skb = skb_dequeue(&bcsp->unrel)) != NULL) { 294 + skb = skb_dequeue(&bcsp->unrel); 295 + if (skb != NULL) { 295 296 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); 296 297 if (nskb) { 297 298 kfree_skb(skb); ··· 309 308 310 309 spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); 311 310 312 - if (bcsp->unack.qlen < BCSP_TXWINSIZE && (skb = skb_dequeue(&bcsp->rel)) != NULL) { 313 - struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); 314 - if (nskb) { 315 - __skb_queue_tail(&bcsp->unack, skb); 316 - mod_timer(&bcsp->tbcsp, jiffies + HZ / 4); 317 - spin_unlock_irqrestore(&bcsp->unack.lock, flags); 318 - return nskb; 319 - } else { 320 - skb_queue_head(&bcsp->rel, skb); 321 - BT_ERR("Could not dequeue pkt because alloc_skb failed"); 311 + if (bcsp->unack.qlen < BCSP_TXWINSIZE) { 312 + skb = skb_dequeue(&bcsp->rel); 313 + if (skb != NULL) { 314 + struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, 315 + bt_cb(skb)->pkt_type); 316 + if (nskb) { 317 + __skb_queue_tail(&bcsp->unack, skb); 318 + mod_timer(&bcsp->tbcsp, jiffies + HZ / 4); 319 + spin_unlock_irqrestore(&bcsp->unack.lock, flags); 320 + return nskb; 321 + } else { 322 + skb_queue_head(&bcsp->rel, skb); 323 + BT_ERR("Could not dequeue pkt because alloc_skb failed"); 324 + } 322 325 } 323 326 } 324 327
+4 -2
drivers/bluetooth/hci_h5.c
··· 673 673 return h5_prepare_pkt(hu, HCI_3WIRE_LINK_PKT, wakeup_req, 2); 674 674 } 675 675 676 - if ((skb = skb_dequeue(&h5->unrel)) != NULL) { 676 + skb = skb_dequeue(&h5->unrel); 677 + if (skb != NULL) { 677 678 nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type, 678 679 skb->data, skb->len); 679 680 if (nskb) { ··· 691 690 if (h5->unack.qlen >= h5->tx_win) 692 691 goto unlock; 693 692 694 - if ((skb = skb_dequeue(&h5->rel)) != NULL) { 693 + skb = skb_dequeue(&h5->rel); 694 + if (skb != NULL) { 695 695 nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type, 696 696 skb->data, skb->len); 697 697 if (nskb) {
+6 -3
drivers/bluetooth/hci_ldisc.c
··· 271 271 if (tty->ops->write == NULL) 272 272 return -EOPNOTSUPP; 273 273 274 - if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { 274 + hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL); 275 + if (!hu) { 275 276 BT_ERR("Can't allocate control structure"); 276 277 return -ENFILE; 277 278 } ··· 570 569 hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; 571 570 hci_uart_ldisc.owner = THIS_MODULE; 572 571 573 - if ((err = tty_register_ldisc(N_HCI, &hci_uart_ldisc))) { 572 + err = tty_register_ldisc(N_HCI, &hci_uart_ldisc); 573 + if (err) { 574 574 BT_ERR("HCI line discipline registration failed. (%d)", err); 575 575 return err; 576 576 } ··· 616 614 #endif 617 615 618 616 /* Release tty registration of line discipline */ 619 - if ((err = tty_unregister_ldisc(N_HCI))) 617 + err = tty_unregister_ldisc(N_HCI); 618 + if (err) 620 619 BT_ERR("Can't unregister HCI line discipline (%d)", err); 621 620 } 622 621