Bug in the peripheral_rscs sample

Just bringing this to your attention.  This has been an issue since at least 2.6.1, and appears to still be a problem in main.

static void connected(struct bt_conn *conn, uint8_t err)
{
    if (err) {
        printk("Connection failed, err 0x%02x %s\n", err, bt_hci_err_to_str(err));
    } else {
        printk("Connected\n");
    }

should be

static void connected(struct bt_conn *conn, uint8_t err)
{
    if (err) {
        printk("Connection failed, err 0x%02x %s\n", err, bt_hci_err_to_str(err));
        return;
    } else {
        printk("Connected\n");
    }

to avoid taking a reference of a failed connection attempt.

https://github.com/nrfconnect/sdk-nrf/blob/bdd28e558d9d3393d495be6b392c755327b51a3b/samples/bluetooth/peripheral_rscs/src/main.c#L144

I'm not blocked by this.

Parents Reply Children
No Data
Related