linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] media-ctl: Initialize ioctl arguments to 0
@ 2016-08-04 11:38 Laurent Pinchart
  2016-08-04 12:01 ` Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2016-08-04 11:38 UTC (permalink / raw)
  To: linux-media; +Cc: sakari.ailus

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

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] media-ctl: Initialize ioctl arguments to 0
  2016-08-04 11:38 [PATCH v2] media-ctl: Initialize ioctl arguments to 0 Laurent Pinchart
@ 2016-08-04 12:01 ` Sakari Ailus
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2016-08-04 12:01 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media

On Thu, Aug 04, 2016 at 02:38:06PM +0300, Laurent Pinchart wrote:
> This ensures that the reserved fields are properly set to 0 as required
> by the API.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Thanks!!!

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-04 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04 11:38 [PATCH v2] media-ctl: Initialize ioctl arguments to 0 Laurent Pinchart
2016-08-04 12:01 ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).