[PATCH v2] media-ctl: Initialize ioctl arguments to 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This ensures that the reserved fields are properly set to 0 as required
by the API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
 utils/media-ctl/libmediactl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Changes since v1:

- Use struct initializers instead of memset

diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
index 636821abc85c..1fd6525b40d3 100644
--- a/utils/media-ctl/libmediactl.c
+++ b/utils/media-ctl/libmediactl.c
@@ -212,8 +212,8 @@ int media_setup_link(struct media_device *media,
 		     struct media_pad *sink,
 		     __u32 flags)
 {
+	struct media_link_desc ulink = { { 0 } };
 	struct media_link *link;
-	struct media_link_desc ulink;
 	unsigned int i;
 	int ret;
 
@@ -324,7 +324,7 @@ static int media_enum_links(struct media_device *media)
 
 	for (id = 1; id <= media->entities_count; id++) {
 		struct media_entity *entity = &media->entities[id - 1];
-		struct media_links_enum links;
+		struct media_links_enum links = { 0 };
 		unsigned int i;
 
 		links.entity = entity->info.id;
@@ -593,6 +593,8 @@ int media_device_enumerate(struct media_device *media)
 	if (ret < 0)
 		return ret;
 
+	memset(&media->info, 0, sizeof(media->info));
+
 	ret = ioctl(media->fd, MEDIA_IOC_DEVICE_INFO, &media->info);
 	if (ret < 0) {
 		ret = -errno;
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux