[Bluetooth] Fix double frees on error paths of btusb and bpa10x drivers
[pandora-kernel.git] / drivers / bluetooth / bluecard_cs.c
index acfb6a4..bcf5792 100644 (file)
@@ -461,20 +461,20 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
                                switch (info->rx_state) {
 
                                case RECV_WAIT_EVENT_HEADER:
-                                       eh = (struct hci_event_hdr *)(info->rx_skb->data);
+                                       eh = hci_event_hdr(info->rx_skb);
                                        info->rx_state = RECV_WAIT_DATA;
                                        info->rx_count = eh->plen;
                                        break;
 
                                case RECV_WAIT_ACL_HEADER:
-                                       ah = (struct hci_acl_hdr *)(info->rx_skb->data);
+                                       ah = hci_acl_hdr(info->rx_skb);
                                        dlen = __le16_to_cpu(ah->dlen);
                                        info->rx_state = RECV_WAIT_DATA;
                                        info->rx_count = dlen;
                                        break;
 
                                case RECV_WAIT_SCO_HEADER:
-                                       sh = (struct hci_sco_hdr *)(info->rx_skb->data);
+                                       sh = hci_sco_hdr(info->rx_skb);
                                        info->rx_state = RECV_WAIT_DATA;
                                        info->rx_count = sh->dlen;
                                        break;
@@ -503,10 +503,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst)
        unsigned int iobase;
        unsigned char reg;
 
-       if (!info || !info->hdev) {
-               BT_ERR("Call of irq %d for unknown device", irq);
-               return IRQ_NONE;
-       }
+       BUG_ON(!info->hdev);
 
        if (!test_bit(CARD_READY, &(info->hw_state)))
                return IRQ_HANDLED;