Skip to content

Commit

Permalink
Bluetooth: conn: check k_work_submit() retcode
Browse files Browse the repository at this point in the history
We still don't know how to handle it but at least it's checked now.

(cherry picked from commit 24c7ad3)

Original-Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
GitOrigin-RevId: 24c7ad3
Change-Id: I9e076373cf60fc2ac3a8bdefd5f3b1ce6955088a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5516682
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
  • Loading branch information
jori-nordic authored and Chromeos LUCI committed May 6, 2024
1 parent 199325c commit 53fd68f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion subsys/bluetooth/host/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,20 @@ static void wait_for_tx_work(struct bt_conn *conn)
tx_notify(conn);
} else {
struct k_work_sync sync;
int err;

/* API docs mention undefined behavior if syncing on work item
* from wq execution context.
*/
__ASSERT_NO_MSG(k_current_get() !=
k_work_queue_thread_get(&k_sys_work_q));

k_work_submit(&conn->tx_complete_work);
err = k_work_submit(&conn->tx_complete_work);
__ASSERT(err >= 0, "couldn't submit (err %d)", err);

k_work_flush(&conn->tx_complete_work, &sync);
}
LOG_DBG("done");
#else
ARG_UNUSED(conn);
#endif /* CONFIG_BT_CONN_TX */
Expand Down

0 comments on commit 53fd68f

Please sign in to comment.