]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: cs46xx memory management fixes for cs46xx_dsp_spos_create()
authorJesper Juhl <jj@chaosbits.net>
Fri, 29 Oct 2010 20:54:45 +0000 (22:54 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 1 Nov 2010 09:26:23 +0000 (10:26 +0100)
commit5208378d9d084db497161d941843bff8fcd24f12
tree2ad6d51e5d84fc765a3fd35b4e73f1fc37bd1def
parentfe3db3b4503e5b483ce357c72aa1ec015a56dacd
ALSA: cs46xx memory management fixes for cs46xx_dsp_spos_create()

When reading through sound/pci/cs46xx/dsp_spos.c I noticed a couple of
things in cs46xx_dsp_spos_create().

It seems to me that we don't always free the various memory buffers we
allocate and we also do some work (structure member assignment) early,
that is completely pointless if some of the memory allocations fail and
we end up just aborting the whole thing.

I don't have hardware to test, so the patch below is compile tested only,
but it makes the following changes:

- Make sure we always free all allocated memory on failures.
- Don't do pointless work assigning to structure members before we know
  all memory allocations, that may abort progress, have completed
  successfully.
- Remove some trailing whitespace.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/cs46xx/dsp_spos.c