V4L/DVB (7036): radio: Use video_device_release rather than kfree

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, January 25, 2008 - 7:15 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f37fdf...
Commit:     f37fdf3ff744bffc35a8f1b9d7d655d8d88a0404
Parent:     a2a9b1eceb50993ef9e126dffc2f678fd6602158
Author:     Julia Lawall <julia@diku.dk>
AuthorDate: Tue Jan 1 18:08:10 2008 -0300
Committer:  Mauro Carvalho Chehab <mchehab@infradead.org>
CommitDate: Fri Jan 25 19:05:02 2008 -0200

    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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index 8e33a19..bc51f4d 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -423,7 +423,7 @@ static int __devinit maestro_probe(struct pci_dev *pdev,
 errunr:
 	video_unregister_device(maestro_radio_inst);
 errfr1:
-	kfree(maestro_radio_inst);
+	video_device_release(maestro_radio_inst);
 errfr:
 	kfree(radio_unit);
 err:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
V4L/DVB (7036): radio: Use video_device_release rather than ..., Linux Kernel Mailing List..., (Fri Jan 25, 7:15 pm)