These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / bluetooth / bt3c_cs.c
index 6de97b3..5803aae 100644 (file)
@@ -202,9 +202,8 @@ static void bt3c_write_wakeup(struct bt3c_info *info)
                /* Send frame */
                len = bt3c_write(iobase, 256, skb->data, skb->len);
 
-               if (len != skb->len) {
+               if (len != skb->len)
                        BT_ERR("Very strange");
-               }
 
                kfree_skb(skb);
 
@@ -234,7 +233,7 @@ static void bt3c_receive(struct bt3c_info *info)
                info->hdev->stat.byte_rx++;
 
                /* Allocate packet */
-               if (info->rx_skb == NULL) {
+               if (!info->rx_skb) {
                        info->rx_state = RECV_WAIT_PACKET_TYPE;
                        info->rx_count = 0;
                        info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
@@ -271,7 +270,6 @@ static void bt3c_receive(struct bt3c_info *info)
                                /* Unknown packet */
                                BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type);
                                info->hdev->stat.err_rx++;
-                               clear_bit(HCI_RUNNING, &(info->hdev->flags));
 
                                kfree_skb(info->rx_skb);
                                info->rx_skb = NULL;
@@ -396,17 +394,12 @@ static int bt3c_hci_flush(struct hci_dev *hdev)
 
 static int bt3c_hci_open(struct hci_dev *hdev)
 {
-       set_bit(HCI_RUNNING, &(hdev->flags));
-
        return 0;
 }
 
 
 static int bt3c_hci_close(struct hci_dev *hdev)
 {
-       if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
-               return 0;
-
        bt3c_hci_flush(hdev);
 
        return 0;
@@ -428,7 +421,7 @@ static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        case HCI_SCODATA_PKT:
                hdev->stat.sco_tx++;
                break;
-       };
+       }
 
        /* Prepend skb with frame type */
        memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
@@ -454,7 +447,8 @@ static int bt3c_load_firmware(struct bt3c_info *info,
 {
        char *ptr = (char *) firmware;
        char b[9];
-       unsigned int iobase, size, addr, fcs, tmp;
+       unsigned int iobase, tmp;
+       unsigned long size, addr, fcs;
        int i, err = 0;
 
        iobase = info->p_dev->resource[0]->start;
@@ -479,15 +473,18 @@ static int bt3c_load_firmware(struct bt3c_info *info,
 
                memset(b, 0, sizeof(b));
                memcpy(b, ptr + 2, 2);
-               size = simple_strtoul(b, NULL, 16);
+               if (kstrtoul(b, 16, &size) < 0)
+                       return -EINVAL;
 
                memset(b, 0, sizeof(b));
                memcpy(b, ptr + 4, 8);
-               addr = simple_strtoul(b, NULL, 16);
+               if (kstrtoul(b, 16, &addr) < 0)
+                       return -EINVAL;
 
                memset(b, 0, sizeof(b));
                memcpy(b, ptr + (size * 2) + 2, 2);
-               fcs = simple_strtoul(b, NULL, 16);
+               if (kstrtoul(b, 16, &fcs) < 0)
+                       return -EINVAL;
 
                memset(b, 0, sizeof(b));
                for (tmp = 0, i = 0; i < size; i++) {