From 5ca1628e7e465c6162de5be4ae5949c704d58b0d Mon Sep 17 00:00:00 2001
From: Matthias Ringwald <matthias@ringwald.ch>
Date: Tue, 5 Jul 2016 11:07:04 +0200
Subject: [PATCH 1/2] chipset/cc256x: fix compile for ANT add-on

---
 chipset/cc256x/ant_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chipset/cc256x/ant_cmd.c b/chipset/cc256x/ant_cmd.c
index 05ffe7930..858da2694 100644
--- a/chipset/cc256x/ant_cmd.c
+++ b/chipset/cc256x/ant_cmd.c
@@ -40,7 +40,7 @@
 
 #include <string.h>
 
-#include "ant_cmds.h"
+#include "ant_cmd.h"
 #include "classic/sdp_util.h"
 #include "btstack_config.h"
 #include "hci.h"

From 70c2750807ca87b19a64971cd0891cf43425bd05 Mon Sep 17 00:00:00 2001
From: Matthias Ringwald <matthias@ringwald.ch>
Date: Tue, 5 Jul 2016 11:07:09 +0200
Subject: [PATCH 2/2] rfcomm: avoid null-pointer dereference for invalid
 rfcomm_cid

---
 src/classic/rfcomm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/classic/rfcomm.c b/src/classic/rfcomm.c
index b0c7d19c6..6f73e9759 100644
--- a/src/classic/rfcomm.c
+++ b/src/classic/rfcomm.c
@@ -2260,11 +2260,9 @@ uint8_t rfcomm_create_channel(btstack_packet_handler_t packet_handler, bd_addr_t
 void rfcomm_disconnect(uint16_t rfcomm_cid){
     log_info("RFCOMM_DISCONNECT cid 0x%02x", rfcomm_cid);
     rfcomm_channel_t * channel = rfcomm_channel_for_rfcomm_cid(rfcomm_cid);
-    if (channel) {
-        channel->state = RFCOMM_CHANNEL_SEND_DISC;
-    }
-    
-    // process
+    if (!channel) return;
+
+    channel->state = RFCOMM_CHANNEL_SEND_DISC;
     l2cap_request_can_send_now_event(channel->multiplexer->l2cap_cid);
 }