From 9aafa973dff5bb804c06becbacd22d2d4e9de464 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 6 Dec 2016 19:21:12 +0200 Subject: [PATCH] Bluetooth: Fix incorrect logging format specifiers Fix compilation issues that show up if SYS_LOG is mapped to printk instead of printf. Unlike printf, printk is annotated so that the compiler catches incorrect format specifiers passed to it. Change-Id: I4d6f635a0ed61de698727028ea8767dc0ef28bb1 Signed-off-by: Johan Hedberg --- drivers/bluetooth/hci/h4.c | 2 +- subsys/bluetooth/host/att.c | 2 +- subsys/bluetooth/host/conn.c | 6 +++--- subsys/bluetooth/host/l2cap.c | 4 ++-- subsys/bluetooth/host/l2cap_br.c | 2 +- subsys/bluetooth/host/sdp.c | 2 +- subsys/bluetooth/host/smp.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/bluetooth/hci/h4.c b/drivers/bluetooth/hci/h4.c index 20f3b3572a7..c18151a5216 100644 --- a/drivers/bluetooth/hci/h4.c +++ b/drivers/bluetooth/hci/h4.c @@ -68,7 +68,7 @@ static int h4_read(struct device *uart, uint8_t *buf, break; } - BT_DBG("read %d remaining %d", rx, len - rx); + BT_DBG("read %d remaining %zu", rx, len - rx); len -= rx; total += rx; buf += rx; diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 3723efef747..42aadbe5a6a 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -1770,7 +1770,7 @@ struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len) } if (len + sizeof(op) > att->chan.tx.mtu) { - BT_WARN("ATT MTU exceeded, max %u, wanted %u", + BT_WARN("ATT MTU exceeded, max %u, wanted %zu", att->chan.tx.mtu, len + sizeof(op)); return NULL; } diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index be900bab89b..0076d74af8f 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1359,9 +1359,9 @@ static int bt_hci_connect_le_cancel(struct bt_conn *conn) int bt_conn_le_param_update(struct bt_conn *conn, const struct bt_le_conn_param *param) { - BT_DBG("conn %p features 0x%x params (%d-%d %d %d)", conn, - conn->le.features[0], param->interval_min, param->interval_max, - param->latency, param->timeout); + BT_DBG("conn %p features 0x%02x params (%d-%d %d %d)", conn, + conn->le.features[0][0], param->interval_min, + param->interval_max, param->latency, param->timeout); /* Check if there's a need to update conn params */ if (conn->le.interval >= param->interval_min && diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 8b119bba145..4c2c3c6f685 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -1190,7 +1190,7 @@ static struct net_buf *l2cap_alloc_frag(struct bt_l2cap_le_chan *chan) return NULL; } - BT_DBG("frag %p tailroom %u", frag, net_buf_tailroom(frag)); + BT_DBG("frag %p tailroom %zu", frag, net_buf_tailroom(frag)); net_buf_frag_add(chan->_sdu, frag); @@ -1203,7 +1203,7 @@ static void l2cap_chan_le_recv_sdu(struct bt_l2cap_le_chan *chan, struct net_buf *frag; uint16_t len; - BT_DBG("chan %p len %u sdu %u", chan, buf->len, + BT_DBG("chan %p len %u sdu %zu", chan, buf->len, net_buf_frags_len(chan->_sdu)); if (net_buf_frags_len(chan->_sdu) + buf->len > chan->_sdu_len) { diff --git a/subsys/bluetooth/host/l2cap_br.c b/subsys/bluetooth/host/l2cap_br.c index 9ee8a1c1c59..788822066b8 100644 --- a/subsys/bluetooth/host/l2cap_br.c +++ b/subsys/bluetooth/host/l2cap_br.c @@ -956,7 +956,7 @@ static uint16_t l2cap_br_conf_opt_mtu(struct bt_l2cap_chan *chan, /* Core 4.2 [Vol 3, Part A, 5.1] MTU payload length */ if (len != 2) { - BT_ERR("tx MTU length %u invalid", len); + BT_ERR("tx MTU length %zu invalid", len); result = BT_L2CAP_CONF_REJECT; goto done; } diff --git a/subsys/bluetooth/host/sdp.c b/subsys/bluetooth/host/sdp.c index d608fc63e96..b7991d6edda 100644 --- a/subsys/bluetooth/host/sdp.c +++ b/subsys/bluetooth/host/sdp.c @@ -294,7 +294,7 @@ int bt_sdp_register_service(struct bt_sdp_record *service) uint32_t handle = SDP_SERVICE_HANDLE_BASE; if (!service) { - BT_ERR("No service record specified", service); + BT_ERR("No service record specified"); return 0; } diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index d82dfe9e036..d5419212601 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -3655,7 +3655,7 @@ int bt_smp_sign_verify(struct bt_conn *conn, struct net_buf *buf) cnt = sys_cpu_to_le32(keys->remote_csrk.cnt); memcpy(net_buf_tail(buf) - sizeof(sig), &cnt, sizeof(cnt)); - BT_DBG("Sign data len %u key %s count %u", buf->len - sizeof(sig), + BT_DBG("Sign data len %zu key %s count %u", buf->len - sizeof(sig), bt_hex(keys->remote_csrk.val, 16), keys->remote_csrk.cnt); err = smp_sign_buf(keys->remote_csrk.val, buf->data,