aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorValentin Ilie <valentin.ilie@gmail.com>2013-08-12 11:46:00 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-03-05 13:52:17 -0500
commita08b15e66e8ec700992641cf8ec015032e8365c8 (patch)
tree01554c5c6963be9da6ba573af135ec7a65f8a9d7 /drivers/bluetooth
parent5981a8821b774ada0be512fd9bad7c241e17657e (diff)
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>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/ath3k.c7
-rw-r--r--drivers/bluetooth/bfusb.c14
-rw-r--r--drivers/bluetooth/bluecard_cs.c9
-rw-r--r--drivers/bluetooth/bt3c_cs.c7
-rw-r--r--drivers/bluetooth/btuart_cs.c6
-rw-r--r--drivers/bluetooth/dtl1_cs.c9
-rw-r--r--drivers/bluetooth/hci_bcsp.c27
-rw-r--r--drivers/bluetooth/hci_h5.c6
-rw-r--r--drivers/bluetooth/hci_ldisc.c9
9 files changed, 59 insertions, 35 deletions
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 4f78a9d39dc8..59b2e6a40913 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -180,10 +180,9 @@ static int ath3k_load_firmware(struct usb_device *udev,
180 } 180 }
181 181
182 memcpy(send_buf, firmware->data, 20); 182 memcpy(send_buf, firmware->data, 20);
183 if ((err = usb_control_msg(udev, pipe, 183 err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
184 USB_REQ_DFU_DNLOAD, 184 0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT);
185 USB_TYPE_VENDOR, 0, 0, 185 if (err < 0) {
186 send_buf, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
187 BT_ERR("Can't change to loading configuration err"); 186 BT_ERR("Can't change to loading configuration err");
188 goto error; 187 goto error;
189 } 188 }
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 31386998c9a7..b2e7e94a6771 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -131,8 +131,11 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
131 131
132 BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len); 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))) 134 if (!urb) {
135 return -ENOMEM; 135 urb = usb_alloc_urb(0, GFP_ATOMIC);
136 if (!urb)
137 return -ENOMEM;
138 }
136 139
137 pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); 140 pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
138 141
@@ -218,8 +221,11 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
218 221
219 BT_DBG("bfusb %p urb %p", data, urb); 222 BT_DBG("bfusb %p urb %p", data, urb);
220 223
221 if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) 224 if (!urb) {
222 return -ENOMEM; 225 urb = usb_alloc_urb(0, GFP_ATOMIC);
226 if (!urb)
227 return -ENOMEM;
228 }
223 229
224 skb = bt_skb_alloc(size, GFP_ATOMIC); 230 skb = bt_skb_alloc(size, GFP_ATOMIC);
225 if (!skb) { 231 if (!skb) {
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 57427de864a6..a9a989e5ee88 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -257,7 +257,8 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
257 ready_bit = XMIT_BUF_ONE_READY; 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 break; 262 break;
262 263
263 if (bt_cb(skb)->pkt_type & 0x80) { 264 if (bt_cb(skb)->pkt_type & 0x80) {
@@ -391,7 +392,8 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
391 if (info->rx_skb == NULL) { 392 if (info->rx_skb == NULL) {
392 info->rx_state = RECV_WAIT_PACKET_TYPE; 393 info->rx_state = RECV_WAIT_PACKET_TYPE;
393 info->rx_count = 0; 394 info->rx_count = 0;
394 if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 395 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
396 if (!info->rx_skb) {
395 BT_ERR("Can't allocate mem for new packet"); 397 BT_ERR("Can't allocate mem for new packet");
396 return; 398 return;
397 } 399 }
@@ -566,7 +568,8 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
566 /* Ericsson baud rate command */ 568 /* Ericsson baud rate command */
567 unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 }; 569 unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 };
568 570
569 if (!(skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 571 skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
572 if (!skb) {
570 BT_ERR("Can't allocate mem for new packet"); 573 BT_ERR("Can't allocate mem for new packet");
571 return -1; 574 return -1;
572 } 575 }
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 73d87994d028..1d82721cf9c6 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -193,8 +193,8 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
193 if (!pcmcia_dev_present(info->p_dev)) 193 if (!pcmcia_dev_present(info->p_dev))
194 break; 194 break;
195 195
196 196 skb = skb_dequeue(&(info->txq));
197 if (!(skb = skb_dequeue(&(info->txq)))) { 197 if (!skb) {
198 clear_bit(XMIT_SENDING, &(info->tx_state)); 198 clear_bit(XMIT_SENDING, &(info->tx_state));
199 break; 199 break;
200 } 200 }
@@ -238,7 +238,8 @@ static void bt3c_receive(bt3c_info_t *info)
238 if (info->rx_skb == NULL) { 238 if (info->rx_skb == NULL) {
239 info->rx_state = RECV_WAIT_PACKET_TYPE; 239 info->rx_state = RECV_WAIT_PACKET_TYPE;
240 info->rx_count = 0; 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 BT_ERR("Can't allocate mem for new packet"); 243 BT_ERR("Can't allocate mem for new packet");
243 return; 244 return;
244 } 245 }
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index a03ecc22a561..fb948f02eda5 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -149,7 +149,8 @@ static void btuart_write_wakeup(btuart_info_t *info)
149 if (!pcmcia_dev_present(info->p_dev)) 149 if (!pcmcia_dev_present(info->p_dev))
150 return; 150 return;
151 151
152 if (!(skb = skb_dequeue(&(info->txq)))) 152 skb = skb_dequeue(&(info->txq));
153 if (!skb)
153 break; 154 break;
154 155
155 /* Send frame */ 156 /* Send frame */
@@ -190,7 +191,8 @@ static void btuart_receive(btuart_info_t *info)
190 if (info->rx_skb == NULL) { 191 if (info->rx_skb == NULL) {
191 info->rx_state = RECV_WAIT_PACKET_TYPE; 192 info->rx_state = RECV_WAIT_PACKET_TYPE;
192 info->rx_count = 0; 193 info->rx_count = 0;
193 if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 194 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
195 if (!info->rx_skb) {
194 BT_ERR("Can't allocate mem for new packet"); 196 BT_ERR("Can't allocate mem for new packet");
195 return; 197 return;
196 } 198 }
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 52eed1f3565d..2bd8fad17206 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -153,7 +153,8 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
153 if (!pcmcia_dev_present(info->p_dev)) 153 if (!pcmcia_dev_present(info->p_dev))
154 return; 154 return;
155 155
156 if (!(skb = skb_dequeue(&(info->txq)))) 156 skb = skb_dequeue(&(info->txq));
157 if (!skb)
157 break; 158 break;
158 159
159 /* Send frame */ 160 /* Send frame */
@@ -215,13 +216,15 @@ static void dtl1_receive(dtl1_info_t *info)
215 info->hdev->stat.byte_rx++; 216 info->hdev->stat.byte_rx++;
216 217
217 /* Allocate packet */ 218 /* Allocate packet */
218 if (info->rx_skb == NULL) 219 if (info->rx_skb == NULL) {
219 if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { 220 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
221 if (!info->rx_skb) {
220 BT_ERR("Can't allocate mem for new packet"); 222 BT_ERR("Can't allocate mem for new packet");
221 info->rx_state = RECV_WAIT_NSH; 223 info->rx_state = RECV_WAIT_NSH;
222 info->rx_count = NSHL; 224 info->rx_count = NSHL;
223 return; 225 return;
224 } 226 }
227 }
225 228
226 *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); 229 *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX);
227 nsh = (nsh_t *)info->rx_skb->data; 230 nsh = (nsh_t *)info->rx_skb->data;
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index eee2fb23b3bf..21cc45b34f13 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -291,7 +291,8 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
291 /* First of all, check for unreliable messages in the queue, 291 /* First of all, check for unreliable messages in the queue,
292 since they have priority */ 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 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); 296 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type);
296 if (nskb) { 297 if (nskb) {
297 kfree_skb(skb); 298 kfree_skb(skb);
@@ -308,16 +309,20 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
308 309
309 spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); 310 spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
310 311
311 if (bcsp->unack.qlen < BCSP_TXWINSIZE && (skb = skb_dequeue(&bcsp->rel)) != NULL) { 312 if (bcsp->unack.qlen < BCSP_TXWINSIZE) {
312 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); 313 skb = skb_dequeue(&bcsp->rel);
313 if (nskb) { 314 if (skb != NULL) {
314 __skb_queue_tail(&bcsp->unack, skb); 315 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
315 mod_timer(&bcsp->tbcsp, jiffies + HZ / 4); 316 bt_cb(skb)->pkt_type);
316 spin_unlock_irqrestore(&bcsp->unack.lock, flags); 317 if (nskb) {
317 return nskb; 318 __skb_queue_tail(&bcsp->unack, skb);
318 } else { 319 mod_timer(&bcsp->tbcsp, jiffies + HZ / 4);
319 skb_queue_head(&bcsp->rel, skb); 320 spin_unlock_irqrestore(&bcsp->unack.lock, flags);
320 BT_ERR("Could not dequeue pkt because alloc_skb failed"); 321 return nskb;
322 } else {
323 skb_queue_head(&bcsp->rel, skb);
324 BT_ERR("Could not dequeue pkt because alloc_skb failed");
325 }
321 } 326 }
322 } 327 }
323 328
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index afd759eaa704..04680ead9275 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -673,7 +673,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
673 return h5_prepare_pkt(hu, HCI_3WIRE_LINK_PKT, wakeup_req, 2); 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 nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type, 678 nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
678 skb->data, skb->len); 679 skb->data, skb->len);
679 if (nskb) { 680 if (nskb) {
@@ -690,7 +691,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
690 if (h5->unack.qlen >= h5->tx_win) 691 if (h5->unack.qlen >= h5->tx_win)
691 goto unlock; 692 goto unlock;
692 693
693 if ((skb = skb_dequeue(&h5->rel)) != NULL) { 694 skb = skb_dequeue(&h5->rel);
695 if (skb != NULL) {
694 nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type, 696 nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
695 skb->data, skb->len); 697 skb->data, skb->len);
696 if (nskb) { 698 if (nskb) {
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 6e06f6f69152..f1fbf4f1e5be 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -271,7 +271,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)
271 if (tty->ops->write == NULL) 271 if (tty->ops->write == NULL)
272 return -EOPNOTSUPP; 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 BT_ERR("Can't allocate control structure"); 276 BT_ERR("Can't allocate control structure");
276 return -ENFILE; 277 return -ENFILE;
277 } 278 }
@@ -569,7 +570,8 @@ static int __init hci_uart_init(void)
569 hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; 570 hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup;
570 hci_uart_ldisc.owner = THIS_MODULE; 571 hci_uart_ldisc.owner = THIS_MODULE;
571 572
572 if ((err = tty_register_ldisc(N_HCI, &hci_uart_ldisc))) { 573 err = tty_register_ldisc(N_HCI, &hci_uart_ldisc);
574 if (err) {
573 BT_ERR("HCI line discipline registration failed. (%d)", err); 575 BT_ERR("HCI line discipline registration failed. (%d)", err);
574 return err; 576 return err;
575 } 577 }
@@ -614,7 +616,8 @@ static void __exit hci_uart_exit(void)
614#endif 616#endif
615 617
616 /* Release tty registration of line discipline */ 618 /* Release tty registration of line discipline */
617 if ((err = tty_unregister_ldisc(N_HCI))) 619 err = tty_unregister_ldisc(N_HCI);
620 if (err)
618 BT_ERR("Can't unregister HCI line discipline (%d)", err); 621 BT_ERR("Can't unregister HCI line discipline (%d)", err);
619} 622}
620 623