Content-Type: multipart/mixed; boundary="===============5140895435705165937==" MIME-Version: 1.0 From: Nathan Chancellor To: kbuild-all@lists.01.org Subject: Re: [PATCH] ALSA: pcm: accept the OPEN state for snd_pcm_stop() Date: Thu, 13 Jan 2022 10:18:08 -0700 Message-ID: In-Reply-To: <202201140042.ARpH6f9U-lkp@intel.com> List-Id: --===============5140895435705165937== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Fri, Jan 14, 2022 at 01:10:23AM +0800, kernel test robot wrote: > Hi Jaroslav, > = > I love your patch! Perhaps something to improve: > = > [auto build test WARNING on tiwai-sound/for-next] > [also build test WARNING on v5.16 next-20220113] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > = > url: https://github.com/0day-ci/linux/commits/Jaroslav-Kysela/ALSA-pcm= -accept-the-OPEN-state-for-snd_pcm_stop/20220113-193304 > base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git f= or-next > config: hexagon-randconfig-r013-20220113 (https://download.01.org/0day-ci= /archive/20220114/202201140042.ARpH6f9U-lkp(a)intel.com/config) > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d102= 1978b8e7e35dcc30201ca1731d64b5a602a8) > reproduce (this is a W=3D1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbi= n/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/18b89b55d815ee4e4f78fa9= 6507d2ad7a03c9c8c > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Jaroslav-Kysela/ALSA-pcm-accept-= the-OPEN-state-for-snd_pcm_stop/20220113-193304 > git checkout 18b89b55d815ee4e4f78fa96507d2ad7a03c9c8c > # save the config file to linux build tree > mkdir build_dir > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W= =3D1 O=3Dbuild_dir ARCH=3Dhexagon SHELL=3D/bin/bash sound/core/ > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > = > All warnings (new ones prefixed by >>): > = > >> sound/core/pcm_native.c:691:2: warning: unannotated fall-through betwe= en switch labels [-Wimplicit-fallthrough] > case SNDRV_PCM_STATE_SETUP: > ^ > sound/core/pcm_native.c:691:2: note: insert 'break;' to avoid fall-thr= ough > case SNDRV_PCM_STATE_SETUP: > ^ > break; = > 1 warning generated. > = > = > vim +691 sound/core/pcm_native.c > = > 60f96aaecb19ca2 Takashi Sakamoto 2017-06-09 674 = > 877211f5e1b1196 Takashi Iwai 2005-11-17 675 static int snd_pcm_hw_= params(struct snd_pcm_substream *substream, > 877211f5e1b1196 Takashi Iwai 2005-11-17 676 struct snd_pcm= _hw_params *params) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 677 { > 877211f5e1b1196 Takashi Iwai 2005-11-17 678 struct snd_pcm_runtim= e *runtime; > 9442e691e4aec85 Takashi Iwai 2006-09-30 679 int err, usecs; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 680 unsigned int bits; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 681 snd_pcm_uframes_t fra= mes; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 682 = > 7eaa943c8ed8e91 Takashi Iwai 2008-08-08 683 if (PCM_RUNTIME_CHECK= (substream)) > 7eaa943c8ed8e91 Takashi Iwai 2008-08-08 684 return -ENXIO; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 685 runtime =3D substream= ->runtime; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 686 snd_pcm_stream_lock_i= rq(substream); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 687 switch (runtime->stat= us->state) { > ^1da177e4c3f415 Linus Torvalds 2005-04-16 688 case SNDRV_PCM_STATE_= OPEN: > 18b89b55d815ee4 Jaroslav Kysela 2022-01-13 689 if (atomic_read(&sub= stream->queued_hw_free)) > 18b89b55d815ee4 Jaroslav Kysela 2022-01-13 690 goto __badfd; Small explanation in case there is some confusion on clang's warning. There should be a break here. GCC accepts implicitly falling through to cases with just a break or a return but the kernel requires all cases to end with either a break, fallthrough, continue, goto, or return. See Documentation/process/deprecated.rst. Cheers, Nathan > ^1da177e4c3f415 Linus Torvalds 2005-04-16 @691 case SNDRV_PCM_STATE_= SETUP: > ^1da177e4c3f415 Linus Torvalds 2005-04-16 692 case SNDRV_PCM_STATE_= PREPARED: > ^1da177e4c3f415 Linus Torvalds 2005-04-16 693 break; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 694 default: > 18b89b55d815ee4 Jaroslav Kysela 2022-01-13 695 __badfd: > ^1da177e4c3f415 Linus Torvalds 2005-04-16 696 snd_pcm_stream_unloc= k_irq(substream); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 697 return -EBADFD; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 698 } > ^1da177e4c3f415 Linus Torvalds 2005-04-16 699 snd_pcm_stream_unlock= _irq(substream); > 8eeaa2f9e06dcfb Takashi Iwai 2014-02-10 700 #if IS_ENABLED(CONFIG_= SND_PCM_OSS) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 701 if (!substream->oss.o= ss) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 702 #endif > 9c323fcbc51493f Takashi Iwai 2006-04-28 703 if (atomic_read(&sub= stream->mmap_count)) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 704 return -EBADFD; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 705 = > 29bb274e9497466 Takashi Iwai 2021-02-06 706 snd_pcm_sync_stop(sub= stream, true); > 1e850beea2781d3 Takashi Iwai 2019-11-17 707 = > ^1da177e4c3f415 Linus Torvalds 2005-04-16 708 params->rmask =3D ~0U; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 709 err =3D snd_pcm_hw_re= fine(substream, params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 710 if (err < 0) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 711 goto _error; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 712 = > ^1da177e4c3f415 Linus Torvalds 2005-04-16 713 err =3D snd_pcm_hw_pa= rams_choose(substream, params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 714 if (err < 0) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 715 goto _error; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 716 = > f9a076bff053100 Takashi Sakamoto 2017-06-09 717 err =3D fixup_unrefer= enced_params(substream, params); > f9a076bff053100 Takashi Sakamoto 2017-06-09 718 if (err < 0) > f9a076bff053100 Takashi Sakamoto 2017-06-09 719 goto _error; > f9a076bff053100 Takashi Sakamoto 2017-06-09 720 = > 0dba808eae2627f Takashi Iwai 2019-11-17 721 if (substream->manage= d_buffer_alloc) { > 0dba808eae2627f Takashi Iwai 2019-11-17 722 err =3D snd_pcm_lib_= malloc_pages(substream, > 0dba808eae2627f Takashi Iwai 2019-11-17 723 params_buf= fer_bytes(params)); > 0dba808eae2627f Takashi Iwai 2019-11-17 724 if (err < 0) > 0dba808eae2627f Takashi Iwai 2019-11-17 725 goto _error; > 0dba808eae2627f Takashi Iwai 2019-11-17 726 runtime->buffer_chan= ged =3D err > 0; > 0dba808eae2627f Takashi Iwai 2019-11-17 727 } > 0dba808eae2627f Takashi Iwai 2019-11-17 728 = > ^1da177e4c3f415 Linus Torvalds 2005-04-16 729 if (substream->ops->h= w_params !=3D NULL) { > ^1da177e4c3f415 Linus Torvalds 2005-04-16 730 err =3D substream->o= ps->hw_params(substream, params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 731 if (err < 0) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 732 goto _error; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 733 } > ^1da177e4c3f415 Linus Torvalds 2005-04-16 734 = > ^1da177e4c3f415 Linus Torvalds 2005-04-16 735 runtime->access =3D p= arams_access(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 736 runtime->format =3D p= arams_format(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 737 runtime->subformat = =3D params_subformat(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 738 runtime->channels =3D= params_channels(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 739 runtime->rate =3D par= ams_rate(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 740 runtime->period_size = =3D params_period_size(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 741 runtime->periods =3D = params_periods(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 742 runtime->buffer_size = =3D params_buffer_size(params); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 743 runtime->info =3D par= ams->info; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 744 runtime->rate_num =3D= params->rate_num; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 745 runtime->rate_den =3D= params->rate_den; > ab69a4904b5dd4d Clemens Ladisch 2010-11-15 746 runtime->no_period_wa= keup =3D > ab69a4904b5dd4d Clemens Ladisch 2010-11-15 747 (params->info & SND= RV_PCM_INFO_NO_PERIOD_WAKEUP) && > ab69a4904b5dd4d Clemens Ladisch 2010-11-15 748 (params->flags & SN= DRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 749 = > ^1da177e4c3f415 Linus Torvalds 2005-04-16 750 bits =3D snd_pcm_form= at_physical_width(runtime->format); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 751 runtime->sample_bits = =3D bits; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 752 bits *=3D runtime->ch= annels; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 753 runtime->frame_bits = =3D bits; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 754 frames =3D 1; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 755 while (bits % 8 !=3D = 0) { > ^1da177e4c3f415 Linus Torvalds 2005-04-16 756 bits *=3D 2; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 757 frames *=3D 2; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 758 } > ^1da177e4c3f415 Linus Torvalds 2005-04-16 759 runtime->byte_align = =3D bits / 8; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 760 runtime->min_align = =3D frames; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 761 = > ^1da177e4c3f415 Linus Torvalds 2005-04-16 762 /* Default sw params = */ > ^1da177e4c3f415 Linus Torvalds 2005-04-16 763 runtime->tstamp_mode = =3D SNDRV_PCM_TSTAMP_NONE; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 764 runtime->period_step = =3D 1; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 765 runtime->control->ava= il_min =3D runtime->period_size; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 766 runtime->start_thresh= old =3D 1; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 767 runtime->stop_thresho= ld =3D runtime->buffer_size; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 768 runtime->silence_thre= shold =3D 0; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 769 runtime->silence_size= =3D 0; > ead4046b2fdfd69 Clemens Ladisch 2010-05-21 770 runtime->boundary =3D= runtime->buffer_size; > ead4046b2fdfd69 Clemens Ladisch 2010-05-21 771 while (runtime->bound= ary * 2 <=3D LONG_MAX - runtime->buffer_size) > ead4046b2fdfd69 Clemens Ladisch 2010-05-21 772 runtime->boundary *= =3D 2; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 773 = > add9d56d7b37815 Takashi Iwai 2019-12-11 774 /* clear the buffer f= or avoiding possible kernel info leaks */ > 618de0f4ef11acd Takashi Iwai 2020-12-18 775 if (runtime->dma_area= && !substream->ops->copy_user) { > 618de0f4ef11acd Takashi Iwai 2020-12-18 776 size_t size =3D runt= ime->dma_bytes; > 618de0f4ef11acd Takashi Iwai 2020-12-18 777 = > 618de0f4ef11acd Takashi Iwai 2020-12-18 778 if (runtime->info & = SNDRV_PCM_INFO_MMAP) > 618de0f4ef11acd Takashi Iwai 2020-12-18 779 size =3D PAGE_ALIGN= (size); > 618de0f4ef11acd Takashi Iwai 2020-12-18 780 memset(runtime->dma_= area, 0, size); > 618de0f4ef11acd Takashi Iwai 2020-12-18 781 } > add9d56d7b37815 Takashi Iwai 2019-12-11 782 = > ^1da177e4c3f415 Linus Torvalds 2005-04-16 783 snd_pcm_timer_resolut= ion_change(substream); > 9b0573c07f278e9 Takashi Iwai 2012-10-12 784 snd_pcm_set_state(sub= stream, SNDRV_PCM_STATE_SETUP); > 9442e691e4aec85 Takashi Iwai 2006-09-30 785 = > 5371a79be97caac Rafael J. Wysocki 2020-02-12 786 if (cpu_latency_qos_r= equest_active(&substream->latency_pm_qos_req)) > 5371a79be97caac Rafael J. Wysocki 2020-02-12 787 cpu_latency_qos_remo= ve_request(&substream->latency_pm_qos_req); > 137c171cf7ecf62 Takashi Iwai 2021-06-08 788 usecs =3D period_to_u= secs(runtime); > 137c171cf7ecf62 Takashi Iwai 2021-06-08 789 if (usecs >=3D 0) > 5371a79be97caac Rafael J. Wysocki 2020-02-12 790 cpu_latency_qos_add_= request(&substream->latency_pm_qos_req, > 5371a79be97caac Rafael J. Wysocki 2020-02-12 791 usecs); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 792 return 0; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 793 _error: > 25985edcedea639 Lucas De Marchi 2011-03-30 794 /* hardware might be = unusable from this time, > ^1da177e4c3f415 Linus Torvalds 2005-04-16 795 so we force applic= ation to retry to set > ^1da177e4c3f415 Linus Torvalds 2005-04-16 796 the correct hardwa= re parameter settings */ > 9b0573c07f278e9 Takashi Iwai 2012-10-12 797 snd_pcm_set_state(sub= stream, SNDRV_PCM_STATE_OPEN); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 798 if (substream->ops->h= w_free !=3D NULL) > ^1da177e4c3f415 Linus Torvalds 2005-04-16 799 substream->ops->hw_f= ree(substream); > 0dba808eae2627f Takashi Iwai 2019-11-17 800 if (substream->manage= d_buffer_alloc) > 0dba808eae2627f Takashi Iwai 2019-11-17 801 snd_pcm_lib_free_pag= es(substream); > ^1da177e4c3f415 Linus Torvalds 2005-04-16 802 return err; > ^1da177e4c3f415 Linus Torvalds 2005-04-16 803 } > ^1da177e4c3f415 Linus Torvalds 2005-04-16 804 = > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org >=20 --===============5140895435705165937==--