Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: imx-jpeg: propagate encoder command errors
@ 2026-10-12 14:18 Avi Weiss
  2026-10-12 18:59 ` Frank Li
  2026-10-13  2:01 ` [EXT] " Ming Qian
  0 siblings, 2 replies; 4+ messages in thread
From: Avi Weiss @ 2026-10-12 14:18 UTC (permalink / raw)
  To: Mirela Rabulea, linux-media
  Cc: Ming Qian, Hans Verkuil, Mauro Carvalho Chehab, imx, Avi Weiss

mxc_jpeg_encoder_cmd() returns success when
v4l2_m2m_ioctl_encoder_cmd() fails. When an encoder command is issued
while the mem2mem context is draining, the helper returns -EBUSY,
but userspace sees success.

Return the helper error, as mxc_jpeg_decoder_cmd() already does.
No obvious reason to clobber the error here.

Fixes: 4911c5acf935 ("media: imx-jpeg: Implement drain using v4l2-mem2mem helpers")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
index e17085935435..5e466ea65a92 100644
--- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
+++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
@@ -1726,7 +1726,7 @@ static int mxc_jpeg_encoder_cmd(struct file *file, void *priv,
 	ret = v4l2_m2m_ioctl_encoder_cmd(file, fh, cmd);
 	spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags);
 	if (ret < 0)
-		return 0;
+		return ret;
 
 	if (cmd->cmd == V4L2_ENC_CMD_STOP &&
 	    v4l2_m2m_has_stopped(fh->m2m_ctx))

base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
-- 
2.43.0


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

* Re: [PATCH] media: imx-jpeg: propagate encoder command errors
  2026-10-12 14:18 [PATCH] media: imx-jpeg: propagate encoder command errors Avi Weiss
@ 2026-10-12 18:59 ` Frank Li
  2026-10-13  2:01 ` [EXT] " Ming Qian
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-10-12 18:59 UTC (permalink / raw)
  To: Avi Weiss
  Cc: Mirela Rabulea, linux-media, Ming Qian, Hans Verkuil,
	Mauro Carvalho Chehab, imx

On Mon, Oct 12, 2026 at 05:18:24PM +0300, Avi Weiss wrote:
> [You don't often get email from thnkslprpt@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> mxc_jpeg_encoder_cmd() returns success when
> v4l2_m2m_ioctl_encoder_cmd() fails. When an encoder command is issued
> while the mem2mem context is draining, the helper returns -EBUSY,
> but userspace sees success.
>
> Return the helper error, as mxc_jpeg_decoder_cmd() already does.
> No obvious reason to clobber the error here.
>
> Fixes: 4911c5acf935 ("media: imx-jpeg: Implement drain using v4l2-mem2mem helpers")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> index e17085935435..5e466ea65a92 100644
> --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> @@ -1726,7 +1726,7 @@ static int mxc_jpeg_encoder_cmd(struct file *file, void *priv,
>         ret = v4l2_m2m_ioctl_encoder_cmd(file, fh, cmd);
>         spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags);
>         if (ret < 0)
> -               return 0;
> +               return ret;
>
>         if (cmd->cmd == V4L2_ENC_CMD_STOP &&
>             v4l2_m2m_has_stopped(fh->m2m_ctx))
>
> base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
> --
> 2.43.0
>
>

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

* RE: [EXT] [PATCH] media: imx-jpeg: propagate encoder command errors
  2026-10-12 14:18 [PATCH] media: imx-jpeg: propagate encoder command errors Avi Weiss
  2026-10-12 18:59 ` Frank Li
@ 2026-10-13  2:01 ` Ming Qian
  2026-10-13 14:47   ` Frank Li
  1 sibling, 1 reply; 4+ messages in thread
From: Ming Qian @ 2026-10-13  2:01 UTC (permalink / raw)
  To: Avi Weiss, Mirela Rabulea, linux-media@vger.kernel.org
  Cc: Hans Verkuil, Mauro Carvalho Chehab, imx@lists.linux.dev




NXP Confidential
>-----Original Message-----
>From: Avi Weiss <thnkslprpt@gmail.com>
>Sent: Monday, October 12, 2026 10:18 PM
>To: Mirela Rabulea <mirela.rabulea@nxp.com>; linux-media@vger.kernel.org
>Cc: Ming Qian <ming.qian@nxp.com>; Hans Verkuil <hverkuil@kernel.org>;
>Mauro Carvalho Chehab <mchehab@kernel.org>; imx@lists.linux.dev; Avi
>Weiss <thnkslprpt@gmail.com>
>Subject: [EXT] [PATCH] media: imx-jpeg: propagate encoder command errors
>
>[You don't often get email from thnkslprpt@gmail.com. Learn why this is
>important at https://aka.ms/LearnAboutSenderIdentification ]
>
>Caution: This is an external email. Please take care when clicking links or
>opening attachments. When in doubt, report the message using the 'Report
>this email' button
>
>
>mxc_jpeg_encoder_cmd() returns success when
>v4l2_m2m_ioctl_encoder_cmd() fails. When an encoder command is issued
>while the mem2mem context is draining, the helper returns -EBUSY, but
>userspace sees success.
>
>Return the helper error, as mxc_jpeg_decoder_cmd() already does.
>No obvious reason to clobber the error here.
>
>Fixes: 4911c5acf935 ("media: imx-jpeg: Implement drain using v4l2-mem2mem
>helpers")
>Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>

Reviewed-by: Ming Qian <ming.qian@oss.nxp.com>

>---
> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>index e17085935435..5e466ea65a92 100644
>--- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>+++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>@@ -1726,7 +1726,7 @@ static int mxc_jpeg_encoder_cmd(struct file *file,
>void *priv,
>        ret = v4l2_m2m_ioctl_encoder_cmd(file, fh, cmd);
>        spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags);
>        if (ret < 0)
>-               return 0;
>+               return ret;
>
>        if (cmd->cmd == V4L2_ENC_CMD_STOP &&
>            v4l2_m2m_has_stopped(fh->m2m_ctx))
>
>base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
>--
>2.43.0


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

* Re: [EXT] [PATCH] media: imx-jpeg: propagate encoder command errors
  2026-10-13  2:01 ` [EXT] " Ming Qian
@ 2026-10-13 14:47   ` Frank Li
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-10-13 14:47 UTC (permalink / raw)
  To: Ming Qian
  Cc: Avi Weiss, Mirela Rabulea, linux-media@vger.kernel.org,
	Hans Verkuil, Mauro Carvalho Chehab, imx@lists.linux.dev

On Tue, Oct 13, 2026 at 02:01:21AM +0000, Ming Qian wrote:
>
>
>
> NXP Confidential

Avoid use "NXP Confidential" for public mail list.

Frank

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

end of thread, other threads:[~2026-10-13 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 14:18 [PATCH] media: imx-jpeg: propagate encoder command errors Avi Weiss
2026-10-12 18:59 ` Frank Li
2026-10-13  2:01 ` [EXT] " Ming Qian
2026-10-13 14:47   ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox