All of lore.kernel.org
 help / color / mirror / Atom feed
* Allocating DMA buffer for non-PCM
@ 2013-02-14 17:03 Adrian Knoth
  2013-02-14 17:14 ` Takashi Iwai
  2013-02-14 17:46 ` Clemens Ladisch
  0 siblings, 2 replies; 9+ messages in thread
From: Adrian Knoth @ 2013-02-14 17:03 UTC (permalink / raw)
  To: alsa-devel

Hi!

Would you say that the following is the proper way to allocate a DMA
buffer used to hold level data?

struct hdspm {
	struct pci_dev *pci;	/* and an pci info */
	struct snd_dma_buffer dmaLevelBuffer;
	u32 *level_buffer;	/* suitably aligned address */
    [..]
}

	/* allocate level buffer */
	err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG,
			snd_dma_pci_data(hdspm->pci),
			MADIFX_LEVEL_BUFFER_SIZE, &hdspm->dmaLevelBuffer);
	if (err < 0) {
    /* error */ [..]
    }

    hdspm->level_buffer = snd_sgbuf_get_ptr(&(hdspm->dmaLevelBuffer), 0);

	memset(hdspm->level_buffer, 0, MADIFX_LEVEL_BUFFER_SIZE);


This used to work on my development machine (kernel 3.6.x), but now a
kernel 3.2.0 user reports a NULL pointer dereference of
hdspm->level_buffer, so apparently, snd_sgbuf_get_ptr() returned NULL
for him.

How could this possibly happen? Am I missing something? Better use
SNDRV_DMA_TYPE_DEV instead?



TIA

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-02-15  9:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 17:03 Allocating DMA buffer for non-PCM Adrian Knoth
2013-02-14 17:14 ` Takashi Iwai
2013-02-14 17:26   ` Adrian Knoth
2013-02-15  6:22     ` Takashi Iwai
2013-02-14 17:46 ` Clemens Ladisch
2013-02-14 17:52   ` Adrian Knoth
2013-02-14 18:01     ` Clemens Ladisch
2013-02-14 18:46       ` Adrian Knoth
2013-02-15  9:04         ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.