Commit a08b15e6 authored by Valentin Ilie's avatar Valentin Ilie Committed by Johan Hedberg

Bluetooth: Remove assignments in if-statements

Remove assignment in if-statements to be consistent with the coding
style.
Signed-off-by: default avatarValentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 5981a882
...@@ -180,10 +180,9 @@ static int ath3k_load_firmware(struct usb_device *udev, ...@@ -180,10 +180,9 @@ static int ath3k_load_firmware(struct usb_device *udev,
} }
memcpy(send_buf, firmware->data, 20); memcpy(send_buf, firmware->data, 20);
if ((err = usb_control_msg(udev, pipe, err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
USB_REQ_DFU_DNLOAD, 0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT);
USB_TYPE_VENDOR, 0, 0, if (err < 0) {
send_buf, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
BT_ERR("Can't change to loading configuration err"); BT_ERR("Can't change to loading configuration err");
goto error; goto error;
} }
......
...@@ -131,8 +131,11 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb) ...@@ -131,8 +131,11 @@ static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb)
BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len); BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len);
if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) if (!urb) {
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb)
return -ENOMEM; return -ENOMEM;
}
pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep);
...@@ -218,8 +221,11 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb) ...@@ -218,8 +221,11 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb)
BT_DBG("bfusb %p urb %p", data, urb); BT_DBG("bfusb %p urb %p", data, urb);
if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) if (!urb) {
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb)
return -ENOMEM; return -ENOMEM;
}
skb = bt_skb_alloc(size, GFP_ATOMIC); skb = bt_skb_alloc(size, GFP_ATOMIC);
if (!skb) { if (!skb) {
......
...@@ -257,7 +257,8 @@ static void bluecard_write_wakeup(bluecard_info_t *info) ...@@ -257,7 +257,8 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
ready_bit = XMIT_BUF_ONE_READY; ready_bit = XMIT_BUF_ONE_READY;
} }
if (!(skb = skb_dequeue(&(info->txq)))) skb = skb_dequeue(&(info->txq));
if (!skb)
break; break;
if (bt_cb(skb)->pkt_type & 0x80) { if (bt_cb(skb)->pkt_type & 0x80) {
...@@ -391,7 +392,8 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset) ...@@ -391,7 +392,8 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
if (info->rx_skb == NULL) { if (info->rx_skb == NULL) {
info->rx_state = RECV_WAIT_PACKET_TYPE; info->rx_state = RECV_WAIT_PACKET_TYPE;
info->rx_count = 0; info->rx_count = 0;
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
if (!info->rx_skb) {
BT_ERR("Can't allocate mem for new packet"); BT_ERR("Can't allocate mem for new packet");
return; return;
} }
...@@ -566,7 +568,8 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) ...@@ -566,7 +568,8 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
/* Ericsson baud rate command */ /* Ericsson baud rate command */
unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 }; unsigned char cmd[] = { HCI_COMMAND_PKT, 0x09, 0xfc, 0x01, 0x03 };
if (!(skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
if (!skb) {
BT_ERR("Can't allocate mem for new packet"); BT_ERR("Can't allocate mem for new packet");
return -1; return -1;
} }
......
...@@ -193,8 +193,8 @@ static void bt3c_write_wakeup(bt3c_info_t *info) ...@@ -193,8 +193,8 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
if (!pcmcia_dev_present(info->p_dev)) if (!pcmcia_dev_present(info->p_dev))
break; break;
skb = skb_dequeue(&(info->txq));
if (!(skb = skb_dequeue(&(info->txq)))) { if (!skb) {
clear_bit(XMIT_SENDING, &(info->tx_state)); clear_bit(XMIT_SENDING, &(info->tx_state));
break; break;
} }
...@@ -238,7 +238,8 @@ static void bt3c_receive(bt3c_info_t *info) ...@@ -238,7 +238,8 @@ static void bt3c_receive(bt3c_info_t *info)
if (info->rx_skb == NULL) { if (info->rx_skb == NULL) {
info->rx_state = RECV_WAIT_PACKET_TYPE; info->rx_state = RECV_WAIT_PACKET_TYPE;
info->rx_count = 0; info->rx_count = 0;
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
if (!info->rx_skb) {
BT_ERR("Can't allocate mem for new packet"); BT_ERR("Can't allocate mem for new packet");
return; return;
} }
......
...@@ -149,7 +149,8 @@ static void btuart_write_wakeup(btuart_info_t *info) ...@@ -149,7 +149,8 @@ static void btuart_write_wakeup(btuart_info_t *info)
if (!pcmcia_dev_present(info->p_dev)) if (!pcmcia_dev_present(info->p_dev))
return; return;
if (!(skb = skb_dequeue(&(info->txq)))) skb = skb_dequeue(&(info->txq));
if (!skb)
break; break;
/* Send frame */ /* Send frame */
...@@ -190,7 +191,8 @@ static void btuart_receive(btuart_info_t *info) ...@@ -190,7 +191,8 @@ static void btuart_receive(btuart_info_t *info)
if (info->rx_skb == NULL) { if (info->rx_skb == NULL) {
info->rx_state = RECV_WAIT_PACKET_TYPE; info->rx_state = RECV_WAIT_PACKET_TYPE;
info->rx_count = 0; info->rx_count = 0;
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
if (!info->rx_skb) {
BT_ERR("Can't allocate mem for new packet"); BT_ERR("Can't allocate mem for new packet");
return; return;
} }
......
...@@ -153,7 +153,8 @@ static void dtl1_write_wakeup(dtl1_info_t *info) ...@@ -153,7 +153,8 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
if (!pcmcia_dev_present(info->p_dev)) if (!pcmcia_dev_present(info->p_dev))
return; return;
if (!(skb = skb_dequeue(&(info->txq)))) skb = skb_dequeue(&(info->txq));
if (!skb)
break; break;
/* Send frame */ /* Send frame */
...@@ -215,13 +216,15 @@ static void dtl1_receive(dtl1_info_t *info) ...@@ -215,13 +216,15 @@ static void dtl1_receive(dtl1_info_t *info)
info->hdev->stat.byte_rx++; info->hdev->stat.byte_rx++;
/* Allocate packet */ /* Allocate packet */
if (info->rx_skb == NULL) if (info->rx_skb == NULL) {
if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
if (!info->rx_skb) {
BT_ERR("Can't allocate mem for new packet"); BT_ERR("Can't allocate mem for new packet");
info->rx_state = RECV_WAIT_NSH; info->rx_state = RECV_WAIT_NSH;
info->rx_count = NSHL; info->rx_count = NSHL;
return; return;
} }
}
*skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX);
nsh = (nsh_t *)info->rx_skb->data; nsh = (nsh_t *)info->rx_skb->data;
......
...@@ -291,7 +291,8 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) ...@@ -291,7 +291,8 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
/* First of all, check for unreliable messages in the queue, /* First of all, check for unreliable messages in the queue,
since they have priority */ since they have priority */
if ((skb = skb_dequeue(&bcsp->unrel)) != NULL) { skb = skb_dequeue(&bcsp->unrel);
if (skb != NULL) {
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type);
if (nskb) { if (nskb) {
kfree_skb(skb); kfree_skb(skb);
...@@ -308,8 +309,11 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) ...@@ -308,8 +309,11 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
if (bcsp->unack.qlen < BCSP_TXWINSIZE && (skb = skb_dequeue(&bcsp->rel)) != NULL) { if (bcsp->unack.qlen < BCSP_TXWINSIZE) {
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type); skb = skb_dequeue(&bcsp->rel);
if (skb != NULL) {
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
bt_cb(skb)->pkt_type);
if (nskb) { if (nskb) {
__skb_queue_tail(&bcsp->unack, skb); __skb_queue_tail(&bcsp->unack, skb);
mod_timer(&bcsp->tbcsp, jiffies + HZ / 4); mod_timer(&bcsp->tbcsp, jiffies + HZ / 4);
...@@ -320,6 +324,7 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) ...@@ -320,6 +324,7 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
BT_ERR("Could not dequeue pkt because alloc_skb failed"); BT_ERR("Could not dequeue pkt because alloc_skb failed");
} }
} }
}
spin_unlock_irqrestore(&bcsp->unack.lock, flags); spin_unlock_irqrestore(&bcsp->unack.lock, flags);
......
...@@ -673,7 +673,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu) ...@@ -673,7 +673,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
return h5_prepare_pkt(hu, HCI_3WIRE_LINK_PKT, wakeup_req, 2); return h5_prepare_pkt(hu, HCI_3WIRE_LINK_PKT, wakeup_req, 2);
} }
if ((skb = skb_dequeue(&h5->unrel)) != NULL) { skb = skb_dequeue(&h5->unrel);
if (skb != NULL) {
nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type, nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
skb->data, skb->len); skb->data, skb->len);
if (nskb) { if (nskb) {
...@@ -690,7 +691,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu) ...@@ -690,7 +691,8 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
if (h5->unack.qlen >= h5->tx_win) if (h5->unack.qlen >= h5->tx_win)
goto unlock; goto unlock;
if ((skb = skb_dequeue(&h5->rel)) != NULL) { skb = skb_dequeue(&h5->rel);
if (skb != NULL) {
nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type, nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
skb->data, skb->len); skb->data, skb->len);
if (nskb) { if (nskb) {
......
...@@ -271,7 +271,8 @@ static int hci_uart_tty_open(struct tty_struct *tty) ...@@ -271,7 +271,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)
if (tty->ops->write == NULL) if (tty->ops->write == NULL)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL);
if (!hu) {
BT_ERR("Can't allocate control structure"); BT_ERR("Can't allocate control structure");
return -ENFILE; return -ENFILE;
} }
...@@ -569,7 +570,8 @@ static int __init hci_uart_init(void) ...@@ -569,7 +570,8 @@ static int __init hci_uart_init(void)
hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup;
hci_uart_ldisc.owner = THIS_MODULE; hci_uart_ldisc.owner = THIS_MODULE;
if ((err = tty_register_ldisc(N_HCI, &hci_uart_ldisc))) { err = tty_register_ldisc(N_HCI, &hci_uart_ldisc);
if (err) {
BT_ERR("HCI line discipline registration failed. (%d)", err); BT_ERR("HCI line discipline registration failed. (%d)", err);
return err; return err;
} }
...@@ -614,7 +616,8 @@ static void __exit hci_uart_exit(void) ...@@ -614,7 +616,8 @@ static void __exit hci_uart_exit(void)
#endif #endif
/* Release tty registration of line discipline */ /* Release tty registration of line discipline */
if ((err = tty_unregister_ldisc(N_HCI))) err = tty_unregister_ldisc(N_HCI);
if (err)
BT_ERR("Can't unregister HCI line discipline (%d)", err); BT_ERR("Can't unregister HCI line discipline (%d)", err);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment