public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@nokia.com>
To: "André Goddard Rosa" <andre.rosa@indt.org.br>
Cc: linux-omap-open-source@linux.omap.com
Subject: Re: Fwd: [PATCH] ARM: OMAP2: Camera: Add OMAP2 24xx camera driver.
Date: Wed, 14 Mar 2007 11:29:38 +0200	[thread overview]
Message-ID: <45F7C082.3070807@nokia.com> (raw)
In-Reply-To: <200703010848.32757.andre.rosa@indt.org.br>

André Goddard Rosa wrote:
> Hi, Sakari!

Hello,

And thanks for the comments!

...
>> +static int
>> +omap24xxcam_mmap(struct file *file, struct vm_area_struct *vma)
>> +{
>> +       struct omap24xxcam_fh *fh = file->private_data;
>> +       int err;
>> +
>> +       /* let the video-buf mapper check arguments and set-up structures */
>> +       err = videobuf_mmap_mapper(&fh->vbq, vma);
>> +       if (err)
>> +               goto err1;
>> +
>> +       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>> +
>> +       /* do mapping to our allocated buffers */
>> +       err = omap24xxcam_mmap_buffers(file, vma);
>> +       if (err)
>> +               goto err2;
> 
> Same comments of Trilok here, but also please find that
> videobuf_mmap_mapper() allocates memory. Where is it
> being released in this case?
> 
> Should we call videobuf_mmap_free() in this error case?

It's that kfree. If you look at the other drivers, no special attention 
is paid on this one. It's because the vidobuf_mmap_mapper is the last 
function called, i.e. there is no case where videobuf_mmap_mapper would 
succeed but the driver's mmap call would fail.

...
>> +       omap24xxcam_sensor_exit(cam);
>> +
>> +       if (cam->vfd) {
>> +               if (cam->vfd->minor == -1) {
>> +                       /* The device was never registered, so release the
>> +                        * video_device struct directly.
>> +                        */
>> +                       video_device_release(cam->vfd);
>> +               } else {
>> +                       /* The unregister function will release the
>> video_device
>> +                        * struct as well as unregistering it.
>> +                        */
>> +                       video_unregister_device(cam->vfd);
> 
> Are you sure that video_unregister_device() calls  video_device_release(cam->vfd)
> or does kfree(cam->vfd) in its regular path?

video_unregister_device doesn't do that directly. I have to check 
further what's happening here.

It indeed looks like a potential memory leak.

Regards,

-- 
Sakari Ailus
sakari.ailus@nokia.com

  parent reply	other threads:[~2007-03-14  9:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-28 15:49 [PATCH] OMAP2 camera and TCM825x sensor drivers Sakari Ailus
2007-02-28 15:59 ` [PATCH] ARM: OMAP2: Camera: Add OMAP2 24xx camera driver Sakari Ailus
2007-02-28 15:59   ` [PATCH] ARM: OMAP2: Camera: Add a driver for TCM825x sensor Sakari Ailus
2007-02-28 15:59     ` [PATCH] ARM: OMAP2: Camera: Modify sensor interface Sakari Ailus
2007-02-28 15:59       ` [PATCH] ARM: OMAP2: Camera: Adapt to 2.6.20 Sakari Ailus
2007-03-01  5:28         ` Trilok Soni
2007-03-02 11:49           ` Sakari Ailus
2007-03-01  7:26   ` [PATCH] ARM: OMAP2: Camera: Add OMAP2 24xx camera driver Trilok Soni
2007-03-02 17:50     ` Sakari Ailus
2007-03-02 15:18   ` Syed Mohammed, Khasim
2007-03-05  9:25     ` Sakari Ailus
2007-03-05 10:26       ` Trilok Soni
2007-03-02 19:12   ` Syed Mohammed, Khasim
     [not found]   ` <b8bf37780702280821wb17104chf75b973b420895ef@mail.gmail.com>
     [not found]     ` <200703010848.32757.andre.rosa@indt.org.br>
2007-03-14  9:29       ` Sakari Ailus [this message]
2007-02-28 16:39 ` [PATCH] OMAP2 camera and TCM825x sensor drivers Syed Mohammed, Khasim
2007-03-01  5:48   ` Trilok Soni
2007-03-01  8:06     ` tony
2007-03-01 23:03       ` Syed Mohammed, Khasim
2007-03-02  4:39         ` sahlot arvind
2007-03-02 11:15           ` André Goddard Rosa
2007-03-07 12:08         ` Sakari Ailus
2007-03-02  9:42   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45F7C082.3070807@nokia.com \
    --to=sakari.ailus@nokia.com \
    --cc=andre.rosa@indt.org.br \
    --cc=linux-omap-open-source@linux.omap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox