Commit 1d1dc7a8 authored by Lyle Zhu's avatar Lyle Zhu Committed by Alberto Escolar
Browse files

Bluetooth: Classic: HF_AG: Fix unexpected return



When `buf->len` is 0, the function of the while-loop
will be returned with error code `-ENOTSUP`.
The code block after while-loop cannot be reached
event though it is a correct command.

Use `buf->len` as the end condition of the while-loop.

Fixes #74730.

Signed-off-by: default avatarLyle Zhu <lyle.zhu@nxp.com>
parent a3a08b93
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -473,7 +473,7 @@ static int bt_hfp_ag_bac_handler(struct bt_hfp_ag *ag, struct net_buf *buf)
	}
	hfp_ag_unlock(ag);

	while (err == 0) {
	while (buf->len > 0) {
		err = get_number(buf, &codec);
		if (err != 0) {
			return -ENOTSUP;