[vlc-devel] [PATCH 1/2] V4L2: Open devices only once.
Rémi Denis-Courmont
remi at remlab.net
Thu Aug 4 11:03:01 CEST 2011
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.
> if( i_fd >= 0 ) v4l2_close( i_fd );
> - return false;
> + return VLC_EGENERIC;
You really should use -1 for this.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list