/* Allocates an mbuf to be used for an ATT response. If an mbuf cannot be allocated, the received request mbuf is reused for the error response.  */
static int ble_att_svr_pkt(struct os_mbuf **rxom, struct os_mbuf **out_txom, uint8_t *out_att_err)
/* Allocates an mbuf to be used for an ATT response. If an mbuf cannot be allocated, the received request mbuf is reused for the error response.  */
static int ble_att_svr_pkt(struct os_mbuf **rxom, struct os_mbuf **out_txom, uint8_t *out_att_err)
{
    *out_txom = ble_hs_mbuf_l2cap_pkt();
    if (*out_txom != NULL) {
        return 0;
    }
    *out_txom = *rxom;
    *rxom = NULL;
    *out_att_err = BLE_ATT_ERR_INSUFFICIENT_RES;
    return BLE_HS_ENOMEM;
}