linux-kernel-test/sound/pci
Julia Lawall 73f6a12ed1 ALSA: sound/pci/mixart/mixart.c: Add missing snd_card_free
The function snd_mixart_create creates a link between mgr and card that
allows snd_mixart_free to free card as well.  But if snd_mixart_create
fails, then the link has not been created and card has to be freed explicitly.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S,S1;
position p1,p2,p3;
expression E,E1;
type T,T1;
expression *ptr != NULL;
@@

(
 if ((x@p1 = snd_card_new(...)) == NULL) S
|
 x@p1 = snd_card_new(...);
)
 ... when != snd_card_free(...,(T)x,...)
     when != if (...) { <+... snd_card_free(...,(T)x,...) ...+> }
     when != true x == NULL || ...
     when != x = E
     when != E = (T)x
     when any
(
 if (x == NULL || ...) S1
|
 if@p2 (...) {
  ... when != snd_card_free(...,(T1)x,...)
      when != if (...) { <+... snd_card_free(...,(T1)x,...) ...+> }
      when != x = E1
      when != E1 = (T1)x
(
  return \(0\|<+...x...+>\|ptr\);
|
  return@p3 ...;
)
}
)

@ script:python @
p1 << r.p1;
p3 << r.p3;
@@

print "* file: %s snd_card_new: %s return: %s" % (p1[0].file,p1[0].line,p3[0].line)

// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-27 15:42:15 +01:00
..
ac97 Merge branch 'topic/fix/misc' into topic/misc 2008-11-07 09:06:05 +01:00
ali5451 [ALSA] Fix synchronize_irq() bugs, redundancies 2008-04-24 12:00:40 +02:00
au88x0 ALSA: Clean up SG-buffer helper functions and macros 2008-08-25 09:57:18 +02:00
aw2 ALSA: aw2 - Fix Oops at initialization 2008-06-23 12:06:23 +02:00
ca0106 ALSA: misc typo fixes 2008-10-19 10:36:08 +02:00
cs46xx ALSA: cs46xx: Add PCI IDs for TerraTec and Hercules cards 2008-10-10 13:41:44 +02:00
cs5535audio [ALSA] fix cs5535 section mismatch 2008-01-31 17:30:12 +01:00
echoaudio ALSA: Clean up SG-buffer helper functions and macros 2008-08-25 09:57:18 +02:00
emu10k1 Merge branch 'topic/fix/misc' into topic/misc 2008-11-07 09:06:05 +01:00
hda ALSA: hda - Fix quirk lists for realtek codecs 2008-10-15 11:24:55 +02:00
ice1712 Merge branch 'topic/fix/misc' into topic/misc 2008-11-07 09:06:05 +01:00
korg1212 ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
mixart ALSA: sound/pci/mixart/mixart.c: Add missing snd_card_free 2008-11-27 15:42:15 +01:00
nm256 ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
oxygen ALSA: oxygen: wait for ACK when resetting UART 2008-09-24 15:25:28 +02:00
pcxhr ALSA: sound/pci/mixart/mixart.c: Add missing snd_card_free 2008-11-27 15:42:15 +01:00
riptide ALSA: Clean up SG-buffer helper functions and macros 2008-08-25 09:57:18 +02:00
rme9652 ALSA: Clean up SG-buffer helper functions and macros 2008-08-25 09:57:18 +02:00
trident ALSA: Clean up SG-buffer helper functions and macros 2008-08-25 09:57:18 +02:00
vx222 ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
ymfpci ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
ad1889.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
ad1889.h
ak4531_codec.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
als300.c [ALSA] sound: replace remaining __FUNCTION__ occurences 2008-04-24 12:00:20 +02:00
als4000.c ALSA: ALS4000 driver work, step 2 2008-08-25 09:57:48 +02:00
atiixp_modem.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
atiixp.c ALSA: atiixp - Add PCI ID for SB600 (1002:4382) 2008-09-04 10:26:36 +02:00
azt3328.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
azt3328.h ALSA: sound/pci/azt3328.h: no variables for enums 2008-07-27 10:22:25 +02:00
bt87x.c ALSA: Clean up SG-buffer helper functions and macros 2008-08-25 09:57:18 +02:00
cmipci.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
cs4281.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
cs5530.c sound: use a common working email address 2008-10-27 16:36:30 +01:00
ens1370.c ALSA: ALSA: ens1370: communicate PCI device to AC97 2008-07-17 14:29:55 +02:00
ens1371.c
es1938.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
es1968.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
fm801.c [ALSA] sound: fm801.c fix shadowed variable warning 2008-04-24 12:00:16 +02:00
intel8x0.c ALSA: intel8x0 - add Dell Optiplex GX620 (AD1981B) to AC97 clock whitelist 2008-10-29 15:12:00 +01:00
intel8x0m.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
Kconfig ALSA: Support NVIDIA MCP78/7A HDMI audio 2008-10-10 13:41:35 +02:00
maestro3.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
Makefile [ALSA] Make ak4531 local to ens1370 driver 2008-05-30 09:26:09 +02:00
rme32.c [ALSA] sound: rme32.c fix integer as NULL pointer warning 2008-04-24 12:00:16 +02:00
rme96.c [ALSA] sound: rme96.c fix integer as NULL pointer warning 2008-04-24 12:00:17 +02:00
sis7019.c [ALSA] Fix synchronize_irq() bugs, redundancies 2008-04-24 12:00:40 +02:00
sis7019.h [ALSA] sis7019: support the SiS 7019 Audio Accelerator 2008-01-31 17:29:36 +01:00
sonicvibes.c ALSA: Kill snd_assert() in sound/pci/* 2008-08-13 11:46:38 +02:00
via82xx_modem.c ALSA: Clean up SG-buffer helper functions and macros 2008-08-25 09:57:18 +02:00
via82xx.c ALSA: via82xx - check continuous pages in buffer setup 2008-08-25 09:57:43 +02:00