[vlc-devel] [PATCH 1/2] V4L2: Open devices only once.

Thierry Reding thierry.reding at avionic-design.de
Thu Aug 4 12:58:47 CEST 2011


* Rémi Denis-Courmont wrote:
> On Thu,  4 Aug 2011 09:53:51 +0200, Thierry Reding
> <thierry.reding at avionic-design.de> wrote:
> > Instead of opening the device once for probing purposes and opening it
> > again when it has been determined suitable, this commit takes the file
> > descriptor obtained during probing and passes it to the initialization
> > function.
> 
> You really should keep the file descriptor in a local variable. With your
> patch, the compiler will load the file descriptor from memory again and
> again as (v4l2_)ioctl() acts a memory barrier.

Okay, so I'll follow up with a patch.

> >      if( i_fd >= 0 ) v4l2_close( i_fd );
> > -    return false;
> > +    return VLC_EGENERIC;
> 
> You really should use -1 for this.

-1 is defined as VLC_ENOMEM. It's kind of a moot point because the return
value from InitVideoDev() is not used anyway.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110804/655c1e3e/attachment.sig>


More information about the vlc-devel mailing list