@@ -425,12 +425,11 @@ static void avdtp_process_configuration_cmd(struct bt_avdtp *session, struct net
425
425
uint8_t tid , bool reconfig )
426
426
{
427
427
int err = 0 ;
428
- int ret ;
429
428
struct bt_avdtp_sep * sep ;
430
429
struct net_buf * rsp_buf ;
431
- uint8_t error_code = 0 ;
430
+ uint8_t avdtp_err_code = 0 ;
432
431
433
- sep = avdtp_get_cmd_sep (buf , & error_code );
432
+ sep = avdtp_get_cmd_sep (buf , & avdtp_err_code );
434
433
avdtp_sep_lock (sep );
435
434
436
435
if (sep == NULL ) {
@@ -450,7 +449,7 @@ static void avdtp_process_configuration_cmd(struct bt_avdtp *session, struct net
450
449
451
450
if (!(sep -> state & expected_state )) {
452
451
err = - ENOTSUP ;
453
- error_code = BT_AVDTP_BAD_STATE ;
452
+ avdtp_err_code = BT_AVDTP_BAD_STATE ;
454
453
} else if (buf -> len >= 1U ) {
455
454
uint8_t int_seid ;
456
455
@@ -459,15 +458,15 @@ static void avdtp_process_configuration_cmd(struct bt_avdtp *session, struct net
459
458
460
459
if (!reconfig ) {
461
460
err = session -> ops -> set_configuration_ind (session , sep , int_seid ,
462
- buf , & error_code );
461
+ buf , & avdtp_err_code );
463
462
} else {
464
463
err = session -> ops -> re_configuration_ind (session , sep , int_seid ,
465
- buf , & error_code );
464
+ buf , & avdtp_err_code );
466
465
}
467
466
} else {
468
467
LOG_WRN ("Invalid INT SEID" );
469
468
err = - ENOTSUP ;
470
- error_code = BT_AVDTP_BAD_LENGTH ;
469
+ avdtp_err_code = BT_AVDTP_BAD_LENGTH ;
471
470
}
472
471
}
473
472
@@ -480,26 +479,26 @@ static void avdtp_process_configuration_cmd(struct bt_avdtp *session, struct net
480
479
}
481
480
482
481
if (err ) {
483
- if (error_code == 0 ) {
484
- error_code = BT_AVDTP_BAD_ACP_SEID ;
482
+ if (avdtp_err_code == 0 ) {
483
+ avdtp_err_code = BT_AVDTP_BAD_ACP_SEID ;
485
484
}
486
485
487
- LOG_DBG ("set configuration err code:%d" , error_code );
486
+ LOG_DBG ("set configuration err code:%d" , avdtp_err_code );
488
487
/* Service Category: Media Codec */
489
488
net_buf_add_u8 (rsp_buf , BT_AVDTP_SERVICE_MEDIA_CODEC );
490
489
/* Length Of Service Capability */
491
490
net_buf_add_u8 (rsp_buf , 0 );
492
491
/* ERROR CODE */
493
- net_buf_add_u8 (rsp_buf , error_code );
492
+ net_buf_add_u8 (rsp_buf , avdtp_err_code );
494
493
}
495
494
496
- ret = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
497
- if (ret ) {
495
+ err = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
496
+ if (err ) {
498
497
net_buf_unref (rsp_buf );
499
- LOG_ERR ("Error:L2CAP send fail - result = %d" , ret );
498
+ LOG_ERR ("Error:L2CAP send fail - result = %d" , err );
500
499
}
501
500
502
- if (!reconfig && !err && !ret ) {
501
+ if (!reconfig && !err && !avdtp_err_code ) {
503
502
bt_avdtp_set_state (sep , AVDTP_CONFIGURED );
504
503
}
505
504
@@ -566,22 +565,21 @@ static void avdtp_re_configure_rsp(struct bt_avdtp *session, struct net_buf *buf
566
565
static void avdtp_open_cmd (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid )
567
566
{
568
567
int err = 0 ;
569
- int ret ;
570
568
struct bt_avdtp_sep * sep ;
571
569
struct net_buf * rsp_buf ;
572
- uint8_t error_code = 0 ;
570
+ uint8_t avdtp_err_code = 0 ;
573
571
574
- sep = avdtp_get_cmd_sep (buf , & error_code );
572
+ sep = avdtp_get_cmd_sep (buf , & avdtp_err_code );
575
573
avdtp_sep_lock (sep );
576
574
577
575
if ((sep == NULL ) || (session -> ops -> open_ind == NULL )) {
578
576
err = - ENOTSUP ;
579
577
} else {
580
578
if (sep -> state != AVDTP_CONFIGURED ) {
581
579
err = - ENOTSUP ;
582
- error_code = BT_AVDTP_BAD_STATE ;
580
+ avdtp_err_code = BT_AVDTP_BAD_STATE ;
583
581
} else {
584
- err = session -> ops -> open_ind (session , sep , & error_code );
582
+ err = session -> ops -> open_ind (session , sep , & avdtp_err_code );
585
583
}
586
584
}
587
585
@@ -593,23 +591,23 @@ static void avdtp_open_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8_
593
591
}
594
592
595
593
if (err ) {
596
- if (error_code == 0 ) {
597
- error_code = BT_AVDTP_BAD_ACP_SEID ;
594
+ if (avdtp_err_code == 0 ) {
595
+ avdtp_err_code = BT_AVDTP_BAD_ACP_SEID ;
598
596
}
599
597
600
- LOG_DBG ("open_ind err code:%d" , error_code );
601
- net_buf_add_u8 (rsp_buf , error_code );
598
+ LOG_DBG ("open_ind err code:%d" , avdtp_err_code );
599
+ net_buf_add_u8 (rsp_buf , avdtp_err_code );
602
600
} else {
603
601
session -> current_sep = sep ;
604
602
}
605
603
606
- ret = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
607
- if (ret ) {
604
+ err = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
605
+ if (err ) {
608
606
net_buf_unref (rsp_buf );
609
- LOG_ERR ("Error:L2CAP send fail - result = %d" , ret );
607
+ LOG_ERR ("Error:L2CAP send fail - result = %d" , err );
610
608
}
611
609
612
- if (!err && !ret ) {
610
+ if (!err && !avdtp_err_code ) {
613
611
bt_avdtp_set_state (sep , AVDTP_OPENING );
614
612
}
615
613
@@ -663,22 +661,21 @@ static void avdtp_handle_reject(struct net_buf *buf, struct bt_avdtp_req *req)
663
661
static void avdtp_start_cmd (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid )
664
662
{
665
663
int err = 0 ;
666
- int ret ;
667
664
struct bt_avdtp_sep * sep ;
668
665
struct net_buf * rsp_buf ;
669
- uint8_t error_code = 0 ;
666
+ uint8_t avdtp_err_code = 0 ;
670
667
671
- sep = avdtp_get_cmd_sep (buf , & error_code );
668
+ sep = avdtp_get_cmd_sep (buf , & avdtp_err_code );
672
669
avdtp_sep_lock (sep );
673
670
674
671
if ((sep == NULL ) || (session -> ops -> start_ind == NULL )) {
675
672
err = - ENOTSUP ;
676
673
} else {
677
674
if (sep -> state != AVDTP_OPEN ) {
678
675
err = - ENOTSUP ;
679
- error_code = BT_AVDTP_BAD_STATE ;
676
+ avdtp_err_code = BT_AVDTP_BAD_STATE ;
680
677
} else {
681
- err = session -> ops -> start_ind (session , sep , & error_code );
678
+ err = session -> ops -> start_ind (session , sep , & avdtp_err_code );
682
679
}
683
680
}
684
681
@@ -690,21 +687,21 @@ static void avdtp_start_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8
690
687
}
691
688
692
689
if (err ) {
693
- if (error_code == 0 ) {
694
- error_code = BT_AVDTP_BAD_ACP_SEID ;
690
+ if (avdtp_err_code == 0 ) {
691
+ avdtp_err_code = BT_AVDTP_BAD_ACP_SEID ;
695
692
}
696
693
697
- LOG_DBG ("start err code:%d" , error_code );
698
- net_buf_add_u8 (rsp_buf , error_code );
694
+ LOG_DBG ("start err code:%d" , avdtp_err_code );
695
+ net_buf_add_u8 (rsp_buf , avdtp_err_code );
699
696
}
700
697
701
- ret = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
702
- if (ret ) {
698
+ err = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
699
+ if (err ) {
703
700
net_buf_unref (rsp_buf );
704
- LOG_ERR ("Error:L2CAP send fail - result = %d" , ret );
701
+ LOG_ERR ("Error:L2CAP send fail - result = %d" , err );
705
702
}
706
703
707
- if (!err && !ret ) {
704
+ if (!err && !avdtp_err_code ) {
708
705
bt_avdtp_set_state (sep , AVDTP_STREAMING );
709
706
}
710
707
@@ -741,22 +738,21 @@ static void avdtp_start_rsp(struct bt_avdtp *session, struct net_buf *buf, uint8
741
738
static void avdtp_close_cmd (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid )
742
739
{
743
740
int err = 0 ;
744
- int ret ;
745
741
struct bt_avdtp_sep * sep ;
746
742
struct net_buf * rsp_buf ;
747
- uint8_t error_code = 0 ;
743
+ uint8_t avdtp_err_code = 0 ;
748
744
749
- sep = avdtp_get_cmd_sep (buf , & error_code );
745
+ sep = avdtp_get_cmd_sep (buf , & avdtp_err_code );
750
746
avdtp_sep_lock (sep );
751
747
752
748
if ((sep == NULL ) || (session -> ops -> close_ind == NULL )) {
753
749
err = - ENOTSUP ;
754
750
} else {
755
751
if (!(sep -> state & (AVDTP_OPEN | AVDTP_STREAMING ))) {
756
752
err = - ENOTSUP ;
757
- error_code = BT_AVDTP_BAD_STATE ;
753
+ avdtp_err_code = BT_AVDTP_BAD_STATE ;
758
754
} else {
759
- err = session -> ops -> close_ind (session , sep , & error_code );
755
+ err = session -> ops -> close_ind (session , sep , & avdtp_err_code );
760
756
}
761
757
}
762
758
@@ -768,23 +764,23 @@ static void avdtp_close_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8
768
764
}
769
765
770
766
if (err ) {
771
- if (error_code == 0 ) {
772
- error_code = BT_AVDTP_BAD_ACP_SEID ;
767
+ if (avdtp_err_code == 0 ) {
768
+ avdtp_err_code = BT_AVDTP_BAD_ACP_SEID ;
773
769
}
774
770
775
- LOG_DBG ("close err code:%d" , error_code );
776
- net_buf_add_u8 (rsp_buf , error_code );
771
+ LOG_DBG ("close err code:%d" , avdtp_err_code );
772
+ net_buf_add_u8 (rsp_buf , avdtp_err_code );
777
773
} else {
778
774
bt_avdtp_set_state (sep , AVDTP_CLOSING );
779
775
}
780
776
781
- ret = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
782
- if (ret ) {
777
+ err = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
778
+ if (err ) {
783
779
net_buf_unref (rsp_buf );
784
- LOG_ERR ("Error:L2CAP send fail - result = %d" , ret );
780
+ LOG_ERR ("Error:L2CAP send fail - result = %d" , err );
785
781
}
786
782
787
- if (!err && !ret ) {
783
+ if (!err && !avdtp_err_code ) {
788
784
bt_avdtp_set_state (sep , AVDTP_IDLE );
789
785
}
790
786
@@ -820,22 +816,21 @@ static void avdtp_close_rsp(struct bt_avdtp *session, struct net_buf *buf, uint8
820
816
static void avdtp_suspend_cmd (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid )
821
817
{
822
818
int err = 0 ;
823
- int ret ;
824
819
struct bt_avdtp_sep * sep ;
825
820
struct net_buf * rsp_buf ;
826
- uint8_t error_code = 0 ;
821
+ uint8_t avdtp_err_code = 0 ;
827
822
828
- sep = avdtp_get_cmd_sep (buf , & error_code );
823
+ sep = avdtp_get_cmd_sep (buf , & avdtp_err_code );
829
824
avdtp_sep_lock (sep );
830
825
831
826
if ((sep == NULL ) || (session -> ops -> suspend_ind == NULL )) {
832
827
err = - ENOTSUP ;
833
828
} else {
834
829
if (sep -> state != AVDTP_STREAMING ) {
835
830
err = - ENOTSUP ;
836
- error_code = BT_AVDTP_BAD_STATE ;
831
+ avdtp_err_code = BT_AVDTP_BAD_STATE ;
837
832
} else {
838
- err = session -> ops -> suspend_ind (session , sep , & error_code );
833
+ err = session -> ops -> suspend_ind (session , sep , & avdtp_err_code );
839
834
}
840
835
}
841
836
@@ -847,21 +842,21 @@ static void avdtp_suspend_cmd(struct bt_avdtp *session, struct net_buf *buf, uin
847
842
}
848
843
849
844
if (err ) {
850
- if (error_code == 0 ) {
851
- error_code = BT_AVDTP_BAD_ACP_SEID ;
845
+ if (avdtp_err_code == 0 ) {
846
+ avdtp_err_code = BT_AVDTP_BAD_ACP_SEID ;
852
847
}
853
848
854
- LOG_DBG ("suspend err code:%d" , error_code );
855
- net_buf_add_u8 (rsp_buf , error_code );
849
+ LOG_DBG ("suspend err code:%d" , avdtp_err_code );
850
+ net_buf_add_u8 (rsp_buf , avdtp_err_code );
856
851
}
857
852
858
- ret = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
859
- if (ret ) {
853
+ err = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
854
+ if (err ) {
860
855
net_buf_unref (rsp_buf );
861
- LOG_ERR ("Error:L2CAP send fail - result = %d" , ret );
856
+ LOG_ERR ("Error:L2CAP send fail - result = %d" , err );
862
857
}
863
858
864
- if (!err && !ret ) {
859
+ if (!err && !avdtp_err_code ) {
865
860
bt_avdtp_set_state (sep , AVDTP_OPEN );
866
861
}
867
862
@@ -898,19 +893,18 @@ static void avdtp_suspend_rsp(struct bt_avdtp *session, struct net_buf *buf, uin
898
893
static void avdtp_abort_cmd (struct bt_avdtp * session , struct net_buf * buf , uint8_t tid )
899
894
{
900
895
int err = 0 ;
901
- int ret ;
902
896
struct bt_avdtp_sep * sep ;
903
897
struct net_buf * rsp_buf ;
904
- uint8_t error_code = 0 ;
898
+ uint8_t avdtp_err_code = 0 ;
905
899
906
- sep = avdtp_get_cmd_sep (buf , & error_code );
900
+ sep = avdtp_get_cmd_sep (buf , & avdtp_err_code );
907
901
avdtp_sep_lock (sep );
908
902
909
903
if ((sep == NULL ) || (session -> ops -> abort_ind == NULL )) {
910
904
err = - ENOTSUP ;
911
905
} else {
912
906
/* all current sep state is OK for abort operation */
913
- err = session -> ops -> abort_ind (session , sep , & error_code );
907
+ err = session -> ops -> abort_ind (session , sep , & avdtp_err_code );
914
908
}
915
909
916
910
rsp_buf = avdtp_create_reply_pdu (err ? BT_AVDTP_REJECT : BT_AVDTP_ACCEPT ,
@@ -921,21 +915,21 @@ static void avdtp_abort_cmd(struct bt_avdtp *session, struct net_buf *buf, uint8
921
915
}
922
916
923
917
if (err ) {
924
- if (error_code == 0 ) {
925
- error_code = BT_AVDTP_BAD_ACP_SEID ;
918
+ if (avdtp_err_code == 0 ) {
919
+ avdtp_err_code = BT_AVDTP_BAD_ACP_SEID ;
926
920
}
927
921
928
- LOG_DBG ("abort err code:%d" , error_code );
929
- net_buf_add_u8 (rsp_buf , error_code );
922
+ LOG_DBG ("abort err code:%d" , avdtp_err_code );
923
+ net_buf_add_u8 (rsp_buf , avdtp_err_code );
930
924
}
931
925
932
- ret = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
933
- if (ret ) {
926
+ err = bt_l2cap_chan_send (& session -> br_chan .chan , rsp_buf );
927
+ if (err ) {
934
928
net_buf_unref (rsp_buf );
935
- LOG_ERR ("Error:L2CAP send fail - result = %d" , ret );
929
+ LOG_ERR ("Error:L2CAP send fail - result = %d" , err );
936
930
}
937
931
938
- if (!err && !ret ) {
932
+ if (!err && !avdtp_err_code ) {
939
933
if ((sep -> state & (AVDTP_OPEN | AVDTP_STREAMING )) &&
940
934
(sep -> chan .state == BT_L2CAP_CONNECTED )) {
941
935
bt_avdtp_set_state (sep , AVDTP_ABORTING );
0 commit comments