linux/drivers/media/common
Julia Lawall a2a9b1eceb V4L/DVB (7035): drivers/media/common: Add missing video_device_release
Video_device_alloc returns the result of a kzalloc.  In this case, the
value is stored in a local variable which is not copied elsewhere before
the point of the error return (video_register_device does not save its
first argument anywhere if it returns a negative value).  Thus, a
video_device_release it needed before the error return.

The problem was found using the following semantic match.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T,T1,T2;
identifier E;
statement S;
expression x1,x2,x3;
int ret;
@@

  T E;
  ...
* E = video_device_alloc(...);
  if (E == NULL) S
  ... when != video_device_release(...,(T1)E,...)
      when != if (E != NULL) { ... video_device_release(...,(T1)E,...); ...}
      when != x1 = (T1)E
      when != E = x3;
      when any
  if (...) {
    ... when != video_device_release(...,(T2)E,...)
        when != if (E != NULL) { ... video_device_release(...,(T2)E,...); ...}
        when != x2 = (T2)E
(
*   return;
|
*   return ret;
)
  }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
CC: Oliver Endriss <o.endriss@gmx.de>
CC: Michael Hunold <michael@mihu.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25 19:05:02 -02:00
..
ir-functions.c V4L/DVB (6574): common/ir-functions.c: make a function static 2008-01-25 19:02:04 -02:00
ir-keymaps.c V4L/DVB (6973): Add Beholder TV 401/405/407/409/505/507/609/M6 support 2008-01-25 19:04:40 -02:00
Kconfig V4L/DVB (6508): ttpci: Rework Kconfig menus and Makefile 2008-01-25 19:01:53 -02:00
Makefile V4L/DVB (3770): Kill drivers/media/common/saa7146_vv_ksyms.c 2006-06-25 01:58:02 -03:00
saa7146_core.c V4L/DVB (6495): saa7146: saa7146_wait_for_debi_done fixes 2007-11-04 21:41:23 -02:00
saa7146_fops.c V4L/DVB (7035): drivers/media/common: Add missing video_device_release 2008-01-25 19:05:02 -02:00
saa7146_hlp.c Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
saa7146_i2c.c V4L/DVB (5987): saa7146: clean-up irq processing 2007-10-09 22:04:44 -03:00
saa7146_vbi.c V4L/DVB (6600): V4L: videobuf: don't chew up namespace STATE_.*, convert to VIDEOBUF_ 2008-01-25 19:02:11 -02:00
saa7146_video.c V4L/DVB (6600): V4L: videobuf: don't chew up namespace STATE_.*, convert to VIDEOBUF_ 2008-01-25 19:02:11 -02:00