--- zzzz-none-000/linux-3.10.107/sound/sparc/cs4231.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/sparc/cs4231.c 2021-02-04 17:41:59.000000000 +0000 @@ -429,7 +429,8 @@ unsigned int period_size = snd_pcm_lib_period_bytes(substream); unsigned int offset = period_size * (*periods_sent); - BUG_ON(period_size >= (1 << 24)); + if (WARN_ON(period_size >= (1 << 24))) + return; if (dma_cont->request(dma_cont, runtime->dma_addr + offset, period_size)) @@ -906,18 +907,24 @@ struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; unsigned long flags; + int ret = 0; spin_lock_irqsave(&chip->lock, flags); chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); - BUG_ON(runtime->period_size > 0xffff + 1); + if (WARN_ON(runtime->period_size > 0xffff + 1)) { + ret = -EINVAL; + goto out; + } chip->p_periods_sent = 0; + +out: spin_unlock_irqrestore(&chip->lock, flags); - return 0; + return ret; } static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream, @@ -1278,19 +1285,11 @@ static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[4] = { + static const char * const texts[4] = { "Line", "CD", "Mic", "Mix" }; - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->count = 2; - uinfo->value.enumerated.items = 4; - if (uinfo->value.enumerated.item > 3) - uinfo->value.enumerated.item = 3; - strcpy(uinfo->value.enumerated.name, - texts[uinfo->value.enumerated.item]); - - return 0; + return snd_ctl_enum_info(uinfo, 2, 4, texts); } static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol, @@ -1558,7 +1557,8 @@ static int dev; -static int cs4231_attach_begin(struct snd_card **rcard) +static int cs4231_attach_begin(struct platform_device *op, + struct snd_card **rcard) { struct snd_card *card; struct snd_cs4231 *chip; @@ -1574,8 +1574,8 @@ return -ENOENT; } - err = snd_card_create(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_cs4231), &card); + err = snd_card_new(&op->dev, index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_cs4231), &card); if (err < 0) return err; @@ -1862,7 +1862,7 @@ struct snd_card *card; int err; - err = cs4231_attach_begin(&card); + err = cs4231_attach_begin(op, &card); if (err) return err; @@ -2053,7 +2053,7 @@ struct snd_card *card; int err; - err = cs4231_attach_begin(&card); + err = cs4231_attach_begin(op, &card); if (err) return err; @@ -2111,7 +2111,6 @@ static struct platform_driver cs4231_driver = { .driver = { .name = "audio", - .owner = THIS_MODULE, .of_match_table = cs4231_match, }, .probe = cs4231_probe,