Re: [PATCH v3 2/2] ASoC: dapm: harden use of lookup tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 04 Feb 2019 22:18:28 +0100,
Pierre-Louis Bossart wrote:
> 
> 
> >> +	WARN_ONCE(ARRAY_SIZE(dapm_up_seq) != SND_SOC_DAPM_TYPE_LAST,
> >> +		  "bad size for dapm_up_seq, expected %d\n",
> >> +		  SND_SOC_DAPM_TYPE_LAST);
> >> +
> >> +	WARN_ONCE(ARRAY_SIZE(dapm_down_seq) != SND_SOC_DAPM_TYPE_LAST,
> >> +		  "bad size for dapm_down_seq, expected %d\n",
> >> +		  SND_SOC_DAPM_TYPE_LAST);
> > Would BUILD_BUG_ON() work for these instead?
> > It's not available, but if it works, better than the runtime check.
> 
> I misunderstood your earlier email then. I also felt testing a
> constant all the time wasn't necessarily very optimal, but since you
> mentioned WARN I used it for all cases.
>
> Are you saying use WARN_ONCE for the uninitialized values and
> BUILD_BUG_ON for the array size check?

Yes.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux