@@ -638,7 +638,6 @@ static int volume_prepare(struct processing_module *mod,
638638 struct module_data * md = & mod -> priv ;
639639 struct comp_dev * dev = mod -> dev ;
640640 struct comp_buffer * sourceb , * sinkb ;
641- struct comp_buffer * source_c , * sink_c ;
642641 uint32_t sink_period_bytes ;
643642 int ret ;
644643 int i ;
@@ -653,20 +652,15 @@ static int volume_prepare(struct processing_module *mod,
653652 sourceb = list_first_item (& dev -> bsource_list ,
654653 struct comp_buffer , sink_list );
655654
656- sink_c = buffer_acquire (sinkb );
657- source_c = buffer_acquire (sourceb );
658-
659- volume_set_alignment (& source_c -> stream , & sink_c -> stream );
660-
661- buffer_release (source_c );
655+ volume_set_alignment (& sourceb -> stream , & sinkb -> stream );
662656
663657 /* get sink period bytes */
664- sink_period_bytes = audio_stream_period_bytes (& sink_c -> stream ,
658+ sink_period_bytes = audio_stream_period_bytes (& sinkb -> stream ,
665659 dev -> frames );
666660
667- if (audio_stream_get_size (& sink_c -> stream ) < sink_period_bytes ) {
661+ if (audio_stream_get_size (& sinkb -> stream ) < sink_period_bytes ) {
668662 comp_err (dev , "volume_prepare(): sink buffer size %d is insufficient < %d" ,
669- audio_stream_get_size (& sink_c -> stream ), sink_period_bytes );
663+ audio_stream_get_size (& sinkb -> stream ), sink_period_bytes );
670664 ret = - ENOMEM ;
671665 goto err ;
672666 }
@@ -680,7 +674,7 @@ static int volume_prepare(struct processing_module *mod,
680674 goto err ;
681675 }
682676
683- cd -> zc_get = vol_get_zc_function (dev , sink_c );
677+ cd -> zc_get = vol_get_zc_function (dev , sinkb );
684678 if (!cd -> zc_get ) {
685679 comp_err (dev , "volume_prepare(): invalid cd->zc_get" );
686680 ret = - EINVAL ;
@@ -695,16 +689,14 @@ static int volume_prepare(struct processing_module *mod,
695689 */
696690 cd -> ramp_finished = false;
697691
698- cd -> channels = audio_stream_get_channels (& sink_c -> stream );
692+ cd -> channels = audio_stream_get_channels (& sinkb -> stream );
699693 if (cd -> channels > SOF_IPC_MAX_CHANNELS ) {
700694 ret = - EINVAL ;
701695 goto err ;
702696 }
703697
704698 cd -> sample_rate_inv = (int32_t )(1000LL * INT32_MAX /
705- audio_stream_get_rate (& sink_c -> stream ));
706-
707- buffer_release (sink_c );
699+ audio_stream_get_rate (& sinkb -> stream ));
708700
709701 for (i = 0 ; i < cd -> channels ; i ++ ) {
710702 cd -> volume [i ] = cd -> vol_min ;
@@ -725,7 +717,6 @@ static int volume_prepare(struct processing_module *mod,
725717 return 0 ;
726718
727719err :
728- buffer_release (sink_c );
729720 comp_set_state (dev , COMP_TRIGGER_RESET );
730721 return ret ;
731722}
0 commit comments