linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] v4l2-ioctl: Give more information when device_caps are missing
@ 2015-06-02 19:07 Laura Abbott
  2015-06-05 11:19 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Laura Abbott @ 2015-06-02 19:07 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil
  Cc: Laura Abbott, linux-media, linux-kernel

Currently, the warning for missing device_caps gives a backtrace like so:

[<ffffffff8175c199>] dump_stack+0x45/0x57
[<ffffffff8109ad5a>] warn_slowpath_common+0x8a/0xc0
[<ffffffff8109ae8a>] warn_slowpath_null+0x1a/0x20
[<ffffffffa0237453>] v4l_querycap+0x43/0x80 [videodev]
[<ffffffffa0237734>] __video_do_ioctl+0x2a4/0x320 [videodev]
[<ffffffff812207e5>] ? do_last+0x195/0x1210
[<ffffffffa023a11e>] video_usercopy+0x22e/0x5b0 [videodev]
[<ffffffffa0237490>] ? v4l_querycap+0x80/0x80 [videodev]
[<ffffffffa023a4b5>] video_ioctl2+0x15/0x20 [videodev]
[<ffffffffa0233733>] v4l2_ioctl+0x113/0x150 [videodev]
[<ffffffff81225798>] do_vfs_ioctl+0x2f8/0x4f0
[<ffffffff8113b2d4>] ? __audit_syscall_entry+0xb4/0x110
[<ffffffff81022d7c>] ? do_audit_syscall_entry+0x6c/0x70
[<ffffffff81225a11>] SyS_ioctl+0x81/0xa0
[<ffffffff8113b526>] ? __audit_syscall_exit+0x1f6/0x2a0
[<ffffffff81763549>] system_call_fastpath+0x12/0x17

This indicates that device_caps are missing but doesn't give
much of a clue which driver is actually at fault. Improve
the warning output by showing the capabilities and which
operations set the capabilities.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index aa407cb..e509608 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1023,8 +1023,9 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
 	 * Drivers MUST fill in device_caps, so check for this and
 	 * warn if it was forgotten.
 	 */
-	WARN_ON(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
-		!cap->device_caps);
+	WARN(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
+		!cap->device_caps, "Bad caps for ops %pS, %x %x",
+		ops, cap->capabilities, cap->device_caps);
 	cap->device_caps |= V4L2_CAP_EXT_PIX_FORMAT;
 
 	return ret;
-- 
2.4.1


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

* Re: [PATCH] [media] v4l2-ioctl: Give more information when device_caps are missing
  2015-06-02 19:07 [PATCH] [media] v4l2-ioctl: Give more information when device_caps are missing Laura Abbott
@ 2015-06-05 11:19 ` Hans Verkuil
  2015-06-05 16:03   ` [PATCH v2] " Laura Abbott
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2015-06-05 11:19 UTC (permalink / raw)
  To: Laura Abbott, Mauro Carvalho Chehab; +Cc: linux-media, linux-kernel

On 06/02/2015 09:07 PM, Laura Abbott wrote:
> Currently, the warning for missing device_caps gives a backtrace like so:
> 
> [<ffffffff8175c199>] dump_stack+0x45/0x57
> [<ffffffff8109ad5a>] warn_slowpath_common+0x8a/0xc0
> [<ffffffff8109ae8a>] warn_slowpath_null+0x1a/0x20
> [<ffffffffa0237453>] v4l_querycap+0x43/0x80 [videodev]
> [<ffffffffa0237734>] __video_do_ioctl+0x2a4/0x320 [videodev]
> [<ffffffff812207e5>] ? do_last+0x195/0x1210
> [<ffffffffa023a11e>] video_usercopy+0x22e/0x5b0 [videodev]
> [<ffffffffa0237490>] ? v4l_querycap+0x80/0x80 [videodev]
> [<ffffffffa023a4b5>] video_ioctl2+0x15/0x20 [videodev]
> [<ffffffffa0233733>] v4l2_ioctl+0x113/0x150 [videodev]
> [<ffffffff81225798>] do_vfs_ioctl+0x2f8/0x4f0
> [<ffffffff8113b2d4>] ? __audit_syscall_entry+0xb4/0x110
> [<ffffffff81022d7c>] ? do_audit_syscall_entry+0x6c/0x70
> [<ffffffff81225a11>] SyS_ioctl+0x81/0xa0
> [<ffffffff8113b526>] ? __audit_syscall_exit+0x1f6/0x2a0
> [<ffffffff81763549>] system_call_fastpath+0x12/0x17
> 
> This indicates that device_caps are missing but doesn't give
> much of a clue which driver is actually at fault. Improve
> the warning output by showing the capabilities and which
> operations set the capabilities.
> 
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
> ---
>  drivers/media/v4l2-core/v4l2-ioctl.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index aa407cb..e509608 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1023,8 +1023,9 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
>  	 * Drivers MUST fill in device_caps, so check for this and
>  	 * warn if it was forgotten.
>  	 */
> -	WARN_ON(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
> -		!cap->device_caps);
> +	WARN(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
> +		!cap->device_caps, "Bad caps for ops %pS, %x %x",
> +		ops, cap->capabilities, cap->device_caps);

Why not just print cap->driver? Much simpler and it always works!

Regards,

	Hans

>  	cap->device_caps |= V4L2_CAP_EXT_PIX_FORMAT;
>  
>  	return ret;
> 


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

* [PATCH v2] v4l2-ioctl: Give more information when device_caps are missing
  2015-06-05 11:19 ` Hans Verkuil
@ 2015-06-05 16:03   ` Laura Abbott
  0 siblings, 0 replies; 3+ messages in thread
From: Laura Abbott @ 2015-06-05 16:03 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil
  Cc: Laura Abbott, linux-media, linux-kernel

Currently, the warning for missing device_caps gives a backtrace like so:

[<ffffffff8175c199>] dump_stack+0x45/0x57
[<ffffffff8109ad5a>] warn_slowpath_common+0x8a/0xc0
[<ffffffff8109ae8a>] warn_slowpath_null+0x1a/0x20
[<ffffffffa0237453>] v4l_querycap+0x43/0x80 [videodev]
[<ffffffffa0237734>] __video_do_ioctl+0x2a4/0x320 [videodev]
[<ffffffff812207e5>] ? do_last+0x195/0x1210
[<ffffffffa023a11e>] video_usercopy+0x22e/0x5b0 [videodev]
[<ffffffffa0237490>] ? v4l_querycap+0x80/0x80 [videodev]
[<ffffffffa023a4b5>] video_ioctl2+0x15/0x20 [videodev]
[<ffffffffa0233733>] v4l2_ioctl+0x113/0x150 [videodev]
[<ffffffff81225798>] do_vfs_ioctl+0x2f8/0x4f0
[<ffffffff8113b2d4>] ? __audit_syscall_entry+0xb4/0x110
[<ffffffff81022d7c>] ? do_audit_syscall_entry+0x6c/0x70
[<ffffffff81225a11>] SyS_ioctl+0x81/0xa0
[<ffffffff8113b526>] ? __audit_syscall_exit+0x1f6/0x2a0
[<ffffffff81763549>] system_call_fastpath+0x12/0x17

This indicates that device_caps are missing but doesn't give
much of a clue which driver is actually at fault. Improve
the warning output by showing the capabilities and the
responsible driver.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index aa407cb..f7cd17d 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1023,8 +1023,9 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
 	 * Drivers MUST fill in device_caps, so check for this and
 	 * warn if it was forgotten.
 	 */
-	WARN_ON(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
-		!cap->device_caps);
+	WARN(!(cap->capabilities & V4L2_CAP_DEVICE_CAPS) ||
+		!cap->device_caps, "Bad caps for driver %s, %x %x",
+		cap->driver, cap->capabilities, cap->device_caps);
 	cap->device_caps |= V4L2_CAP_EXT_PIX_FORMAT;
 
 	return ret;
-- 
2.4.1


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

end of thread, other threads:[~2015-06-05 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-02 19:07 [PATCH] [media] v4l2-ioctl: Give more information when device_caps are missing Laura Abbott
2015-06-05 11:19 ` Hans Verkuil
2015-06-05 16:03   ` [PATCH v2] " Laura Abbott

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).