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

Commit f4de8fe6 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Remove superfluous memory allocation error messages



The memory allocators should have already given the kernel warning
messages, thus we don't have to annoy again.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6efdd851
Loading
Loading
Loading
Loading
+4 −12
Original line number Original line Diff line number Diff line
@@ -776,10 +776,8 @@ int snd_hda_bus_new(struct snd_card *card,
		*busp = NULL;
		*busp = NULL;


	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
	if (bus == NULL) {
	if (!bus)
		dev_err(card->dev, "can't allocate struct hda_bus\n");
		return -ENOMEM;
		return -ENOMEM;
	}


	bus->card = card;
	bus->card = card;
	mutex_init(&bus->cmd_mutex);
	mutex_init(&bus->cmd_mutex);
@@ -1223,10 +1221,8 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
	}
	}


	codec = kzalloc(sizeof(*codec), GFP_KERNEL);
	codec = kzalloc(sizeof(*codec), GFP_KERNEL);
	if (codec == NULL) {
	if (!codec)
		dev_err(card->dev, "can't allocate struct hda_codec\n");
		return -ENOMEM;
		return -ENOMEM;
	}


	dev = hda_codec_dev(codec);
	dev = hda_codec_dev(codec);
	device_initialize(dev);
	device_initialize(dev);
@@ -1307,10 +1303,8 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,


	fg = codec->afg ? codec->afg : codec->mfg;
	fg = codec->afg ? codec->afg : codec->mfg;
	err = read_widget_caps(codec, fg);
	err = read_widget_caps(codec, fg);
	if (err < 0) {
	if (err < 0)
		dev_err(card->dev, "cannot malloc\n");
		goto error;
		goto error;
	}
	err = read_pin_defaults(codec);
	err = read_pin_defaults(codec);
	if (err < 0)
	if (err < 0)
		goto error;
		goto error;
@@ -1371,10 +1365,8 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec)
	kfree(codec->wcaps);
	kfree(codec->wcaps);
	fg = codec->afg ? codec->afg : codec->mfg;
	fg = codec->afg ? codec->afg : codec->mfg;
	err = read_widget_caps(codec, fg);
	err = read_widget_caps(codec, fg);
	if (err < 0) {
	if (err < 0)
		codec_err(codec, "cannot malloc\n");
		return err;
		return err;
	}


	snd_array_free(&codec->init_pins);
	snd_array_free(&codec->init_pins);
	err = read_pin_defaults(codec);
	err = read_pin_defaults(codec);
+4 −14
Original line number Original line Diff line number Diff line
@@ -974,14 +974,9 @@ static int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
 */
 */
static int azx_alloc_cmd_io(struct azx *chip)
static int azx_alloc_cmd_io(struct azx *chip)
{
{
	int err;

	/* single page (at least 4096 bytes) must suffice for both ringbuffes */
	/* single page (at least 4096 bytes) must suffice for both ringbuffes */
	err = chip->ops->dma_alloc_pages(chip, SNDRV_DMA_TYPE_DEV,
	return chip->ops->dma_alloc_pages(chip, SNDRV_DMA_TYPE_DEV,
					  PAGE_SIZE, &chip->rb);
					  PAGE_SIZE, &chip->rb);
	if (err < 0)
		dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n");
	return err;
}
}
EXPORT_SYMBOL_GPL(azx_alloc_cmd_io);
EXPORT_SYMBOL_GPL(azx_alloc_cmd_io);


@@ -1472,7 +1467,6 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus,
int azx_alloc_stream_pages(struct azx *chip)
int azx_alloc_stream_pages(struct azx *chip)
{
{
	int i, err;
	int i, err;
	struct snd_card *card = chip->card;


	for (i = 0; i < chip->num_streams; i++) {
	for (i = 0; i < chip->num_streams; i++) {
		dsp_lock_init(&chip->azx_dev[i]);
		dsp_lock_init(&chip->azx_dev[i]);
@@ -1480,18 +1474,14 @@ int azx_alloc_stream_pages(struct azx *chip)
		err = chip->ops->dma_alloc_pages(chip, SNDRV_DMA_TYPE_DEV,
		err = chip->ops->dma_alloc_pages(chip, SNDRV_DMA_TYPE_DEV,
						 BDL_SIZE,
						 BDL_SIZE,
						 &chip->azx_dev[i].bdl);
						 &chip->azx_dev[i].bdl);
		if (err < 0) {
		if (err < 0)
			dev_err(card->dev, "cannot allocate BDL\n");
			return -ENOMEM;
			return -ENOMEM;
	}
	}
	}
	/* allocate memory for the position buffer */
	/* allocate memory for the position buffer */
	err = chip->ops->dma_alloc_pages(chip, SNDRV_DMA_TYPE_DEV,
	err = chip->ops->dma_alloc_pages(chip, SNDRV_DMA_TYPE_DEV,
					 chip->num_streams * 8, &chip->posbuf);
					 chip->num_streams * 8, &chip->posbuf);
	if (err < 0) {
	if (err < 0)
		dev_err(card->dev, "cannot allocate posbuf\n");
		return -ENOMEM;
		return -ENOMEM;
	}


	/* allocate CORB/RIRB */
	/* allocate CORB/RIRB */
	err = azx_alloc_cmd_io(chip);
	err = azx_alloc_cmd_io(chip);
+1 −4
Original line number Original line Diff line number Diff line
@@ -1383,7 +1383,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,


	hda = kzalloc(sizeof(*hda), GFP_KERNEL);
	hda = kzalloc(sizeof(*hda), GFP_KERNEL);
	if (!hda) {
	if (!hda) {
		dev_err(card->dev, "Cannot allocate hda\n");
		pci_disable_device(pci);
		pci_disable_device(pci);
		return -ENOMEM;
		return -ENOMEM;
	}
	}
@@ -1564,10 +1563,8 @@ static int azx_first_init(struct azx *chip)
	chip->num_streams = chip->playback_streams + chip->capture_streams;
	chip->num_streams = chip->playback_streams + chip->capture_streams;
	chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev),
	chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev),
				GFP_KERNEL);
				GFP_KERNEL);
	if (!chip->azx_dev) {
	if (!chip->azx_dev)
		dev_err(card->dev, "cannot malloc azx_dev\n");
		return -ENOMEM;
		return -ENOMEM;
	}


	err = azx_alloc_stream_pages(chip);
	err = azx_alloc_stream_pages(chip);
	if (err < 0)
	if (err < 0)