Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da3cec35 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela
Browse files

ALSA: Kill snd_assert() in sound/pci/*



Kill snd_assert() in sound/pci/*, either removed or replaced with
if () with snd_BUG_ON().

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 622207dc
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -1890,8 +1890,8 @@ int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
		.dev_free =	snd_ac97_bus_dev_free,
	};

	snd_assert(card != NULL, return -EINVAL);
	snd_assert(rbus != NULL, return -EINVAL);
	if (snd_BUG_ON(!card))
		return -EINVAL;
	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
	if (bus == NULL)
		return -ENOMEM;
@@ -1906,6 +1906,7 @@ int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
		snd_ac97_bus_free(bus);
		return err;
	}
	if (rbus)
		*rbus = bus;
	return 0;
}
@@ -1991,10 +1992,14 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
		.dev_disconnect =	snd_ac97_dev_disconnect,
	};

	snd_assert(rac97 != NULL, return -EINVAL);
	if (rac97)
		*rac97 = NULL;
	snd_assert(bus != NULL && template != NULL, return -EINVAL);
	snd_assert(template->num < 4 && bus->codec[template->num] == NULL, return -EINVAL);
	if (snd_BUG_ON(!bus || !template))
		return -EINVAL;
	if (snd_BUG_ON(template->num >= 4))
		return -EINVAL;
	if (bus->codec[template->num])
		return -EBUSY;

	card = bus->card;
	ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);
+4 −2
Original line number Diff line number Diff line
@@ -549,7 +549,8 @@ snd_ad1889_playback_pointer(struct snd_pcm_substream *ss)
	ptr = ad1889_readl(chip, AD_DMA_WAVCA);
	ptr -= chip->wave.addr;
	
	snd_assert((ptr >= 0) && (ptr < chip->wave.size), return 0);
	if (snd_BUG_ON(ptr >= chip->wave.size))
		return 0;
	
	return bytes_to_frames(ss->runtime, ptr);
}
@@ -567,7 +568,8 @@ snd_ad1889_capture_pointer(struct snd_pcm_substream *ss)
	ptr = ad1889_readl(chip, AD_DMA_ADCCA);
	ptr -= chip->ramc.addr;

	snd_assert((ptr >= 0) && (ptr < chip->ramc.size), return 0);
	if (snd_BUG_ON(ptr >= chip->ramc.size))
		return 0;
	
	return bytes_to_frames(ss->runtime, ptr);
}
+6 −4
Original line number Diff line number Diff line
@@ -392,9 +392,10 @@ int __devinit snd_ak4531_mixer(struct snd_card *card,
		.dev_free =	snd_ak4531_dev_free,
	};

	snd_assert(rak4531 != NULL, return -EINVAL);
	if (snd_BUG_ON(!card || !_ak4531))
		return -EINVAL;
	if (rak4531)
		*rak4531 = NULL;
	snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL);
	ak4531 = kzalloc(sizeof(*ak4531), GFP_KERNEL);
	if (ak4531 == NULL)
		return -ENOMEM;
@@ -428,6 +429,7 @@ int __devinit snd_ak4531_mixer(struct snd_card *card,
#if 0
	snd_ak4531_dump(ak4531);
#endif
	if (rak4531)
		*rak4531 = ak4531;
	return 0;
}
+7 −3
Original line number Diff line number Diff line
@@ -722,7 +722,9 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
	struct atiixp_dma *dma = substream->runtime->private_data;
	int err = 0;

	snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
	if (snd_BUG_ON(!dma->ops->enable_transfer ||
		       !dma->ops->flush_dma))
		return -EINVAL;

	spin_lock(&chip->reg_lock);
	switch (cmd) {
@@ -1032,7 +1034,8 @@ static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
	struct snd_pcm_runtime *runtime = substream->runtime;
	int err;

	snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
	if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
		return -EINVAL;

	if (dma->opened)
		return -EBUSY;
@@ -1064,7 +1067,8 @@ static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
{
	struct atiixp *chip = snd_pcm_substream_chip(substream);
	/* disable DMA bits */
	snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
	if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
		return -EINVAL;
	spin_lock_irq(&chip->reg_lock);
	dma->ops->enable_dma(chip, 0);
	spin_unlock_irq(&chip->reg_lock);
+7 −3
Original line number Diff line number Diff line
@@ -674,7 +674,9 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
	struct atiixp_dma *dma = substream->runtime->private_data;
	int err = 0;

	snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
	if (snd_BUG_ON(!dma->ops->enable_transfer ||
		       !dma->ops->flush_dma))
		return -EINVAL;

	spin_lock(&chip->reg_lock);
	switch(cmd) {
@@ -865,7 +867,8 @@ static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
		.mask = 0,
	};

	snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
	if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
		return -EINVAL;

	if (dma->opened)
		return -EBUSY;
@@ -895,7 +898,8 @@ static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
{
	struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
	/* disable DMA bits */
	snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
	if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
		return -EINVAL;
	spin_lock_irq(&chip->reg_lock);
	dma->ops->enable_dma(chip, 0);
	spin_unlock_irq(&chip->reg_lock);
Loading