All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com,
	dafna.hirschfeld@collabora.com, helen.koike@collabora.com,
	ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com,
	dafna3@gmail.com, sakari.ailus@linux.intel.com,
	linux-rockchip@lists.infradead.org, mchehab@kernel.org,
	tfiga@chromium.org
Subject: [patch v4l-utils 1/2] v4l2-ctl: print specific error upon failure
Date: Fri, 16 Jul 2021 14:57:02 +0200	[thread overview]
Message-ID: <20210716125703.699-2-dafna.hirschfeld@collabora.com> (raw)
In-Reply-To: <20210716125703.699-1-dafna.hirschfeld@collabora.com>

When an operation fails, print an error message
that specify the specific operation that failed
prefixed with the current function name.
This makes debugging less painful.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 62424e4c..0f28a537 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1153,8 +1153,10 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
 			q.g_type() == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
 	bool is_meta = q.g_type() == V4L2_BUF_TYPE_META_OUTPUT;
 
-	if (q.obtain_bufs(&fd))
+	if (q.obtain_bufs(&fd)) {
+		fprintf(stderr, "%s q.obtain_bufs failed\n", __func__);
 		return QUEUE_ERROR;
+	}
 
 	fd.g_fmt(fmt, q.g_type());
 	{
@@ -1226,8 +1228,10 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
 	for (unsigned i = 0; i < q.g_buffers(); i++) {
 		cv4l_buffer buf(q);
 
-		if (fd.querybuf(buf, i))
+		if (fd.querybuf(buf, i)) {
+			fprintf(stderr, "%s fd.querybuf failed\n", __func__);
 			return QUEUE_ERROR;
+		}
 
 		buf.update(q, i);
 		for (unsigned j = 0; j < q.g_num_planes(); j++)
@@ -2720,11 +2724,21 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd)
 		fprintf(stderr, "mismatch between number of planes\n");
 		goto done;
 	}
+	if (in.obtain_bufs(&fd)) {
+		fprintf(stderr, "%s: in.obtain_bufs failed\n", __func__);
+		goto done;
+	}
 
-	if (in.obtain_bufs(&fd) ||
-	    in.queue_all(&fd) ||
-	    do_setup_out_buffers(out_fd, out, file[OUT], false, false) == QUEUE_ERROR)
+	if (in.queue_all(&fd)) {
+		fprintf(stderr, "%s: in.queue_all failed\n", __func__);
 		goto done;
+	}
+
+
+	if (do_setup_out_buffers(out_fd, out, file[OUT], false, false) == QUEUE_ERROR) {
+		fprintf(stderr, "%s: do_setup_out_buffers failed\n", __func__);
+		goto done;
+	}
 
 	fps_ts[CAP].determine_field(fd.g_fd(), in.g_type());
 	fps_ts[OUT].determine_field(fd.g_fd(), out.g_type());
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com,
	dafna.hirschfeld@collabora.com, helen.koike@collabora.com,
	ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com,
	dafna3@gmail.com, sakari.ailus@linux.intel.com,
	linux-rockchip@lists.infradead.org, mchehab@kernel.org,
	tfiga@chromium.org
Subject: [patch v4l-utils 1/2] v4l2-ctl: print specific error upon failure
Date: Fri, 16 Jul 2021 14:57:02 +0200	[thread overview]
Message-ID: <20210716125703.699-2-dafna.hirschfeld@collabora.com> (raw)
In-Reply-To: <20210716125703.699-1-dafna.hirschfeld@collabora.com>

When an operation fails, print an error message
that specify the specific operation that failed
prefixed with the current function name.
This makes debugging less painful.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 62424e4c..0f28a537 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1153,8 +1153,10 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
 			q.g_type() == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
 	bool is_meta = q.g_type() == V4L2_BUF_TYPE_META_OUTPUT;
 
-	if (q.obtain_bufs(&fd))
+	if (q.obtain_bufs(&fd)) {
+		fprintf(stderr, "%s q.obtain_bufs failed\n", __func__);
 		return QUEUE_ERROR;
+	}
 
 	fd.g_fmt(fmt, q.g_type());
 	{
@@ -1226,8 +1228,10 @@ static int do_setup_out_buffers(cv4l_fd &fd, cv4l_queue &q, FILE *fin, bool qbuf
 	for (unsigned i = 0; i < q.g_buffers(); i++) {
 		cv4l_buffer buf(q);
 
-		if (fd.querybuf(buf, i))
+		if (fd.querybuf(buf, i)) {
+			fprintf(stderr, "%s fd.querybuf failed\n", __func__);
 			return QUEUE_ERROR;
+		}
 
 		buf.update(q, i);
 		for (unsigned j = 0; j < q.g_num_planes(); j++)
@@ -2720,11 +2724,21 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd)
 		fprintf(stderr, "mismatch between number of planes\n");
 		goto done;
 	}
+	if (in.obtain_bufs(&fd)) {
+		fprintf(stderr, "%s: in.obtain_bufs failed\n", __func__);
+		goto done;
+	}
 
-	if (in.obtain_bufs(&fd) ||
-	    in.queue_all(&fd) ||
-	    do_setup_out_buffers(out_fd, out, file[OUT], false, false) == QUEUE_ERROR)
+	if (in.queue_all(&fd)) {
+		fprintf(stderr, "%s: in.queue_all failed\n", __func__);
 		goto done;
+	}
+
+
+	if (do_setup_out_buffers(out_fd, out, file[OUT], false, false) == QUEUE_ERROR) {
+		fprintf(stderr, "%s: do_setup_out_buffers failed\n", __func__);
+		goto done;
+	}
 
 	fps_ts[CAP].determine_field(fd.g_fd(), in.g_type());
 	fps_ts[OUT].determine_field(fd.g_fd(), out.g_type());
-- 
2.17.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2021-07-16 12:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 12:57 [patch v4l-utils 0/2] Fix bugs found with dmabuf Dafna Hirschfeld
2021-07-16 12:57 ` Dafna Hirschfeld
2021-07-16 12:57 ` Dafna Hirschfeld [this message]
2021-07-16 12:57   ` [patch v4l-utils 1/2] v4l2-ctl: print specific error upon failure Dafna Hirschfeld
2021-07-16 12:57 ` [patch v4l-utils 2/2] v4l2-ctl: fix bugs found in streaming_set_cap2out Dafna Hirschfeld
2021-07-16 12:57   ` Dafna Hirschfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210716125703.699-2-dafna.hirschfeld@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=ezequiel@collabora.com \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.