[libcamera-devel] [PATCH] libcamera: v4l2_videodevice: Fix uninitialised watchdogDuration_

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Apr 6 17:09:15 CEST 2022


Hi Umang,

Thank you for the patch.

On Wed, Apr 06, 2022 at 08:15:53PM +0530, Umang Jain wrote:
> Initialise the watchdogDuration_ member to 0ms before it is used
> in rest of the code base. Failing to do so, spews out log warnings
> regarding dequeue timer being expired.
> 
> Fixes: 16f3d2de50ff ("libcamera: v4l2_videodevice: Add a dequeue timer")
> Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
>  src/libcamera/v4l2_videodevice.cpp | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 634ac4a5..8e0afffe 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -39,6 +39,8 @@
>  
>  namespace libcamera {
>  
> +using namespace std::literals::chrono_literals;
> +
>  LOG_DECLARE_CATEGORY(V4L2)
>  
>  /**
> @@ -520,7 +522,8 @@ const std::string V4L2DeviceFormat::toString() const
>   */
>  V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode)
>  	: V4L2Device(deviceNode), formatInfo_(nullptr), cache_(nullptr),
> -	  fdBufferNotifier_(nullptr), state_(State::Stopped)
> +	  fdBufferNotifier_(nullptr), state_(State::Stopped),
> +	  watchdogDuration_(0ms)

The duration is expressed in nanoseconds internally, but thanks to
chrono types, that doesn't matter :-)

I would write

	watchdogDuration_(0.0)

but that's not possible as the utils::Duration class is missing an
appropriate constructor. I'll fix this in a separate patch, but for
this,

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>  {
>  	/*
>  	 * We default to an MMAP based CAPTURE video device, however this will

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list