libcamera: v4l2_device: Zero-initialize V4L2 format

Zero initialize v4l2_format structures used to set and get format on the
V4L2 device.

Fixes: ba8da0f2fc ("libcamera: v4l2_device: Add methods to get/set format")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2019-02-01 10:04:00 +01:00
parent a9f302dc05
commit f8c0c5817e

View file

@ -299,7 +299,7 @@ int V4L2Device::setFormat(V4L2DeviceFormat *format)
int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format)
{ {
struct v4l2_format v4l2Format; struct v4l2_format v4l2Format = {};
struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; struct v4l2_pix_format *pix = &v4l2Format.fmt.pix;
int ret; int ret;
@ -323,7 +323,7 @@ int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format)
int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format) int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format)
{ {
struct v4l2_format v4l2Format; struct v4l2_format v4l2Format = {};
struct v4l2_pix_format *pix = &v4l2Format.fmt.pix; struct v4l2_pix_format *pix = &v4l2Format.fmt.pix;
int ret; int ret;
@ -344,7 +344,7 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format)
int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format)
{ {
struct v4l2_format v4l2Format; struct v4l2_format v4l2Format = {};
struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp;
int ret; int ret;
@ -371,7 +371,7 @@ int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format)
int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format)
{ {
struct v4l2_format v4l2Format; struct v4l2_format v4l2Format = {};
struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp; struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp;
int ret; int ret;