linux/drivers/media/video
Julia Lawall a8782f669c V4L/DVB (9796): drivers/media/video/cx88/cx88-alsa.c: Adjust error-handling code
In the function cx88_audio_initdev, the value card has been created using
snd_card_new.  The other error handling code in this function frees the
value using snd_card_free.  I have thus changed the first error case to do
the same.  On the other hand, it may be that card is not sufficiently
initialized at this point to use snd_card_free, in which case something
else should be done to free the memory in the error case.

In the function snd_cx88_create the call kfree(chip) in one error case
looks suspicious, both because it is not done in the other error code, and
because chip points into the middle of the memory allocated by
snd_card_new, ie it is not itself associated with a separate kmalloc.
Therefore I have removed it.

The semantic match that finds the first 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:26 -02:00
..
au0828 V4L/DVB (9252): au0828: Checkpatch compliance 2008-10-17 17:27:26 -03:00
bt8xx V4L/DVB (9677): bttv: fix some entries on Phytec boards and add missing ones 2008-12-29 17:53:37 -02:00
cpia2 V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
cx18 V4L/DVB (9778): cx18: cx18_writel_expect() should not declare success on a PCI read error 2008-12-30 09:38:20 -02:00
cx88 V4L/DVB (9796): drivers/media/video/cx88/cx88-alsa.c: Adjust error-handling code 2008-12-30 09:38:26 -02:00
cx23885 V4L/DVB (9795): Add Compro VideoMate E650F (DVB-T part only). 2008-12-30 09:38:25 -02:00
cx25840 V4L/DVB (9507): v4l: remove EXPERIMENTAL from several drivers 2008-12-29 17:53:26 -02:00
em28xx V4L/DVB (9793): em28xx: Add specific entry for WinTV-HVR 850 2008-12-30 09:38:25 -02:00
et61x251 V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-29 17:53:26 -02:00
gspca V4L/DVB (9710): gspca: Remove some unuseful core in main. 2008-12-30 09:38:06 -02:00
ivtv V4L/DVB (9508): ivtv: enable tuner support for Yuan PG600-2 2008-12-29 17:53:26 -02:00
ovcamchip V4L/DVB (8906): v4l-dvb: fix assorted sparse warnings 2008-10-12 09:36:58 -02:00
pvrusb2 V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-29 17:53:26 -02:00
pwc V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
saa7134 V4L/DVB (9772): saa7134: Add support for Kworld Plus TV Analog Lite PCI 2008-12-30 09:38:17 -02:00
sn9c102 V4L/DVB (9711): gspca: Let gspca handle the webcams 045e:00f5 & 00f7 instead of sn9c102. 2008-12-29 17:53:40 -02:00
usbvideo V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
usbvision V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-29 17:53:26 -02:00
uvc V4L/DVB (9662): uvcvideo: Fix printk badness when printing ioctl names 2008-12-29 17:53:36 -02:00
zc0301 V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-29 17:53:26 -02:00
zoran V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
adv7170.c V4L/DVB (9198): adv7170: convert i2c driver for new i2c API 2008-10-17 17:15:58 -03:00
adv7175.c V4L/DVB (9199): adv7175: convert i2c driver for new i2c API 2008-10-17 17:16:08 -03:00
arv.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
bt819.c V4L/DVB (9200): bt819: convert i2c driver for new i2c API 2008-10-17 17:17:20 -03:00
bt856.c V4L/DVB (9201): bt856: convert i2c driver for new i2c API 2008-10-17 17:17:30 -03:00
bt866.c V4L/DVB (9202): bt866: convert i2c driver for new i2c API 2008-10-17 17:17:36 -03:00
btcx-risc.c V4L/DVB (8745): v4l2: fix a bunch of compile warnings. 2008-10-12 09:36:52 -02:00
btcx-risc.h V4L/DVB (8757): v4l-dvb: fix a bunch of sparse warnings 2008-09-03 18:37:13 -03:00
bw-qcam.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
bw-qcam.h V4L/DVB (8780): v4l: replace the last uses of video_exclusive_open/release 2008-10-12 09:36:53 -02:00
c-qcam.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
cafe_ccic-regs.h
cafe_ccic.c V4L/DVB (9355): de-BKL cafe_ccic.c 2008-11-11 08:11:20 -02:00
cpia_pp.c
cpia_usb.c
cpia.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
cpia.h
cs53l32a.c
cs5345.c
cs8420.h
cx2341x.c V4L/DVB (8634): v4l2: extend MPEG Encoding API with AVC and AAC 2008-10-12 09:36:47 -02:00
dabusb.c USB: remove warn() macro from usb media drivers 2008-10-17 14:41:08 -07:00
dabusb.h
font.h
hexium_gemini.c
hexium_orion.c
ibmmpeg2.h
indycam.c
indycam.h
ir-kbd-i2c.c V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-29 17:53:26 -02:00
Kconfig V4L/DVB (9507): v4l: remove EXPERIMENTAL from several drivers 2008-12-29 17:53:26 -02:00
ks0127.c V4L/DVB (9203): ks0127: convert i2c driver for new i2c API 2008-10-17 17:17:40 -03:00
ks0127.h
m52790.c
Makefile V4L/DVB (9533): cx88: Add support for TurboSight TBS8910 DVB-S PCI card 2008-12-29 17:53:28 -02:00
meye.c V4L/DVB (8780): v4l: replace the last uses of video_exclusive_open/release 2008-10-12 09:36:53 -02:00
meye.h V4L/DVB (8780): v4l: replace the last uses of video_exclusive_open/release 2008-10-12 09:36:53 -02:00
msp3400-driver.c
msp3400-driver.h
msp3400-kthreads.c
mt9m001.c V4L/DVB (9788): soc-camera: simplify naming 2008-12-30 09:38:23 -02:00
mt9m111.c V4L/DVB (9788): soc-camera: simplify naming 2008-12-30 09:38:23 -02:00
mt9v022.c V4L/DVB (9788): soc-camera: simplify naming 2008-12-30 09:38:23 -02:00
mxb.c V4L/DVB (8945): mxb: use unique i2c adapter name 2008-10-12 09:37:00 -02:00
mxb.h
ov511.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
ov511.h V4L/DVB (9116): USB: remove info() macro from usb media drivers 2008-10-12 09:37:14 -02:00
ov772x.c V4L/DVB (9788): soc-camera: simplify naming 2008-12-30 09:38:23 -02:00
ov7670.c
pms.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
pxa_camera.c V4L/DVB (9791): pxa-camera: pixel format negotiation 2008-12-30 09:38:24 -02:00
s2255drv.c V4L/DVB (9635): v4l: s2255drv fix firmware test on big-endian 2008-11-16 23:57:23 -02:00
saa711x_regs.h
saa717x.c
saa5246a.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
saa5249.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
saa6588.c
saa7110.c V4L/DVB (9372): Minor fixes to the saa7110 driver 2008-11-11 08:11:23 -02:00
saa7111.c V4L/DVB (9205): saa7111: convert i2c driver for new i2c API 2008-10-17 17:17:52 -03:00
saa7114.c V4L/DVB (9206): saa7114: convert i2c driver for new i2c API 2008-10-17 17:19:41 -03:00
saa7115.c V4L/DVB (9162): ivtv: fix raw/sliced VBI mixup 2008-10-13 09:08:01 -02:00
saa7121.h
saa7127.c V4L/DVB (9240): saa7127: Fix two typos 2008-10-17 17:25:11 -03:00
saa7146.h
saa7146reg.h
saa7185.c V4L/DVB (9207): saa7185: convert i2c driver for new i2c API 2008-10-17 17:20:01 -03:00
saa7191.c
saa7191.h
se401.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
se401.h
sh_mobile_ceu_camera.c V4L/DVB (9788): soc-camera: simplify naming 2008-12-30 09:38:23 -02:00
soc_camera_platform.c V4L/DVB (9788): soc-camera: simplify naming 2008-12-30 09:38:23 -02:00
soc_camera.c V4L/DVB (9790): soc-camera: pixel format negotiation - core support 2008-12-30 09:38:24 -02:00
stk-sensor.c
stk-webcam.c V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d 2008-10-21 14:31:37 -02:00
stk-webcam.h V4L/DVB (9193): stk-webcam: minor cleanup 2008-10-17 17:14:57 -03:00
stradis.c V4L/DVB (8783): v4l: add all missing video_device release callbacks 2008-10-12 09:36:54 -02:00
stv680.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
stv680.h
tcm825x.c
tcm825x.h
tda7432.c
tda9840.c V4L/DVB (9033): drivers/media/video/tda9840.c: unbreak 2008-10-12 09:37:08 -02:00
tda9840.h V4L/DVB (8941): mxb/tda9840: cleanups, use module saa7115 instead of saa7111. 2008-10-12 09:37:00 -02:00
tda9875.c
tea6415c.c V4L/DVB (8630): First mxb cleanup phase 2008-10-12 09:36:47 -02:00
tea6415c.h
tea6420.c V4L/DVB (8630): First mxb cleanup phase 2008-10-12 09:36:47 -02:00
tea6420.h
tlv320aic23b.c
tuner-core.c V4L/DVB (9049): convert tuner drivers to use dvb_frontend->callback 2008-10-12 09:37:09 -02:00
tvaudio.c V4L/DVB (9624): CVE-2008-5033: fix OOPS on tvaudio when controlling bass/treble 2008-11-14 14:39:47 -02:00
tveeprom.c V4L/DVB (9268): tuner: add FMD1216MEX tuner 2008-10-17 17:29:09 -03:00
tvp5150_reg.h
tvp5150.c V4L/DVB (9363): tvp5150: add support to enable raw vbi 2008-12-29 17:53:13 -02:00
upd64031a.c
upd64083.c
v4l1-compat.c V4L/DVB (9330): Get rid of inode parameter at v4l_compat_translate_ioctl() 2008-10-21 14:31:45 -02:00
v4l2-common.c V4L/DVB (9491): rationalise addresses to one common one 2008-12-29 17:53:25 -02:00
v4l2-compat-ioctl32.c V4L/DVB (9484): v4l: rename compat_ioctl32.c to v4l2-compat-ioctl32.c 2008-12-29 17:53:25 -02:00
v4l2-dev.c V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-29 17:53:26 -02:00
v4l2-int-device.c V4L/DVB (9322): v4l2-int-if: Export more interfaces to modules 2008-10-21 14:31:20 -02:00
v4l2-ioctl.c V4L/DVB (9591): v4l core: fix debug printk for enumberating framerates 2008-12-29 17:53:33 -02:00
videobuf-core.c
videobuf-dma-contig.c
videobuf-dma-sg.c
videobuf-dvb.c V4L/DVB (9335): videobuf: split unregister bus creating self-contained frontend de-allocator 2008-10-21 14:32:08 -02:00
videobuf-vmalloc.c
vino.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
vino.h
vivi.c V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d 2008-10-21 14:31:37 -02:00
vp27smpx.c
vpx3220.c V4L/DVB (9208): vpx3220: convert i2c driver for new i2c API 2008-10-17 17:20:13 -03:00
w9966.c V4L/DVB (9503): v4l: remove inode argument from video_usercopy 2008-12-29 17:53:26 -02:00
w9968cf_decoder.h
w9968cf_vpp.h
w9968cf.c V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d 2008-10-21 14:31:37 -02:00
w9968cf.h
wm8739.c
wm8775.c
zr364xx.c V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d 2008-10-21 14:31:37 -02:00