]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
V4L/DVB (7036): radio: Use video_device_release rather than kfree
authorJulia Lawall <julia@diku.dk>
Tue, 1 Jan 2008 21:08:10 +0000 (18:08 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:05:02 +0000 (19:05 -0200)
commitf37fdf3ff744bffc35a8f1b9d7d655d8d88a0404
tree21c73351ab02291f5c579bed18ea4e88ee5ec98f
parenta2a9b1eceb50993ef9e126dffc2f678fd6602158
V4L/DVB (7036): radio: Use video_device_release rather than kfree

The file drivers/media/video/videodev.c defines both video_device_alloc and
video_device_release.  These are essentially just kzmalloc and kfree,
respectively, but it seems better to use video_device_release, as done in
the other media files, rather than kfree, in case the implementation some
day changes.

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: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/radio/radio-maestro.c