• Julia Lawall's avatar
    V4L/DVB (7036): radio: Use video_device_release rather than kfree · f37fdf3f
    Julia Lawall authored
    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: default avatarJulia Lawall <julia@diku.dk>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
    f37fdf3f
radio-maestro.c 11.1 KB