Skip to content

Commit c703237

Browse files
bluetooth: avdtp: avoid that the ret and err exist together
Keep the err in code as it is convention in Bluetooth code, change ret as l2cap_ret because it is the return value of l2cap send function. Signed-off-by: Mark Wang <yichang.wang@nxp.com>
1 parent 4bb5ffd commit c703237

File tree

1 file changed

+30
-30
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+30
-30
lines changed

subsys/bluetooth/host/classic/avdtp.c

+30-30
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static void avdtp_process_configuration_cmd(struct bt_avdtp *session, struct net
425425
uint8_t tid, bool reconfig)
426426
{
427427
int err = 0;
428-
int ret;
428+
int l2cap_ret;
429429
struct bt_avdtp_sep *sep;
430430
struct net_buf *rsp_buf;
431431
uint8_t error_code = 0;
@@ -493,13 +493,13 @@ static void avdtp_process_configuration_cmd(struct bt_avdtp *session, struct net
493493
net_buf_add_u8(rsp_buf, error_code);
494494
}
495495

496-
ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
497-
if (ret) {
496+
l2cap_ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
497+
if (l2cap_ret) {
498498
net_buf_unref(rsp_buf);
499-
LOG_ERR("Error:L2CAP send fail - result = %d", ret);
499+
LOG_ERR("Error:L2CAP send fail - result = %d", l2cap_ret);
500500
}
501501

502-
if (!reconfig && !err && !ret) {
502+
if (!reconfig && !err && !l2cap_ret) {
503503
bt_avdtp_set_state(sep, AVDTP_CONFIGURED);
504504
}
505505

@@ -566,7 +566,7 @@ static void avdtp_re_configure_rsp(struct bt_avdtp *session, struct net_buf *buf
566566
static void avdtp_open_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8_t tid)
567567
{
568568
int err = 0;
569-
int ret;
569+
int l2cap_ret;
570570
struct bt_avdtp_sep *sep;
571571
struct net_buf *rsp_buf;
572572
uint8_t error_code = 0;
@@ -603,13 +603,13 @@ static void avdtp_open_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8_
603603
session->current_sep = sep;
604604
}
605605

606-
ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
607-
if (ret) {
606+
l2cap_ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
607+
if (l2cap_ret) {
608608
net_buf_unref(rsp_buf);
609-
LOG_ERR("Error:L2CAP send fail - result = %d", ret);
609+
LOG_ERR("Error:L2CAP send fail - result = %d", l2cap_ret);
610610
}
611611

612-
if (!err && !ret) {
612+
if (!err && !l2cap_ret) {
613613
bt_avdtp_set_state(sep, AVDTP_OPENING);
614614
}
615615

@@ -663,7 +663,7 @@ static void avdtp_handle_reject(struct net_buf *buf, struct bt_avdtp_req *req)
663663
static void avdtp_start_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8_t tid)
664664
{
665665
int err = 0;
666-
int ret;
666+
int l2cap_ret;
667667
struct bt_avdtp_sep *sep;
668668
struct net_buf *rsp_buf;
669669
uint8_t error_code = 0;
@@ -698,13 +698,13 @@ static void avdtp_start_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8
698698
net_buf_add_u8(rsp_buf, error_code);
699699
}
700700

701-
ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
702-
if (ret) {
701+
l2cap_ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
702+
if (l2cap_ret) {
703703
net_buf_unref(rsp_buf);
704-
LOG_ERR("Error:L2CAP send fail - result = %d", ret);
704+
LOG_ERR("Error:L2CAP send fail - result = %d", l2cap_ret);
705705
}
706706

707-
if (!err && !ret) {
707+
if (!err && !l2cap_ret) {
708708
bt_avdtp_set_state(sep, AVDTP_STREAMING);
709709
}
710710

@@ -741,7 +741,7 @@ static void avdtp_start_rsp(struct bt_avdtp *session, struct net_buf *buf, uint8
741741
static void avdtp_close_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8_t tid)
742742
{
743743
int err = 0;
744-
int ret;
744+
int l2cap_ret;
745745
struct bt_avdtp_sep *sep;
746746
struct net_buf *rsp_buf;
747747
uint8_t error_code = 0;
@@ -778,13 +778,13 @@ static void avdtp_close_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8
778778
bt_avdtp_set_state(sep, AVDTP_CLOSING);
779779
}
780780

781-
ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
782-
if (ret) {
781+
l2cap_ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
782+
if (l2cap_ret) {
783783
net_buf_unref(rsp_buf);
784-
LOG_ERR("Error:L2CAP send fail - result = %d", ret);
784+
LOG_ERR("Error:L2CAP send fail - result = %d", l2cap_ret);
785785
}
786786

787-
if (!err && !ret) {
787+
if (!err && !l2cap_ret) {
788788
bt_avdtp_set_state(sep, AVDTP_IDLE);
789789
}
790790

@@ -820,7 +820,7 @@ static void avdtp_close_rsp(struct bt_avdtp *session, struct net_buf *buf, uint8
820820
static void avdtp_suspend_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8_t tid)
821821
{
822822
int err = 0;
823-
int ret;
823+
int l2cap_ret;
824824
struct bt_avdtp_sep *sep;
825825
struct net_buf *rsp_buf;
826826
uint8_t error_code = 0;
@@ -855,13 +855,13 @@ static void avdtp_suspend_cmd(struct bt_avdtp *session, struct net_buf *buf, uin
855855
net_buf_add_u8(rsp_buf, error_code);
856856
}
857857

858-
ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
859-
if (ret) {
858+
l2cap_ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
859+
if (l2cap_ret) {
860860
net_buf_unref(rsp_buf);
861-
LOG_ERR("Error:L2CAP send fail - result = %d", ret);
861+
LOG_ERR("Error:L2CAP send fail - result = %d", l2cap_ret);
862862
}
863863

864-
if (!err && !ret) {
864+
if (!err && !l2cap_ret) {
865865
bt_avdtp_set_state(sep, AVDTP_OPEN);
866866
}
867867

@@ -898,7 +898,7 @@ static void avdtp_suspend_rsp(struct bt_avdtp *session, struct net_buf *buf, uin
898898
static void avdtp_abort_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8_t tid)
899899
{
900900
int err = 0;
901-
int ret;
901+
int l2cap_ret;
902902
struct bt_avdtp_sep *sep;
903903
struct net_buf *rsp_buf;
904904
uint8_t error_code = 0;
@@ -929,13 +929,13 @@ static void avdtp_abort_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8
929929
net_buf_add_u8(rsp_buf, error_code);
930930
}
931931

932-
ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
933-
if (ret) {
932+
l2cap_ret = bt_l2cap_chan_send(&session->br_chan.chan, rsp_buf);
933+
if (l2cap_ret) {
934934
net_buf_unref(rsp_buf);
935-
LOG_ERR("Error:L2CAP send fail - result = %d", ret);
935+
LOG_ERR("Error:L2CAP send fail - result = %d", l2cap_ret);
936936
}
937937

938-
if (!err && !ret) {
938+
if (!err && !l2cap_ret) {
939939
if ((sep->state & (AVDTP_OPEN | AVDTP_STREAMING)) &&
940940
(sep->chan.state == BT_L2CAP_CONNECTED)) {
941941
bt_avdtp_set_state(sep, AVDTP_ABORTING);

0 commit comments

Comments
 (0)