Skip to contentSkip to conversation

media: imx-jpeg: propagate encoder command errors

PATCH Applied Avi Weiss 3 participants 5 messages Oct 12 – Nov 4

Subsystems (3)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 media: imx-jpeg: propagate encoder command errors

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")
---
 drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +1 -1
index e17085935435..5e466ea65a92 100644
@@ -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

Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Avi Weiss

[You don't often get email from [email protected]. 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.

Quoted 6 lines

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

---

Quoted 22 lines
 drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +1 -1
index e17085935435..5e466ea65a92 100644
@@ -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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Avi Weiss

NXP Confidential

Quoted 22 lines

-----Original Message-----
From: Avi Weiss <[email protected]>
Sent: Monday, October 12, 2026 10:18 PM
To: Mirela Rabulea <[email protected]>; [email protected]
Cc: Ming Qian <[email protected]>; Hans Verkuil <[email protected]>; Mauro Carvalho Chehab <[email protected]>; [email protected]; Avi Weiss <[email protected]>
Subject: [EXT] [PATCH] media: imx-jpeg: propagate encoder command errors

[You don't often get email from [email protected]. 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.

Quoted 6 lines

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

Quoted 23 lines

---
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +1 -1
index e17085935435..5e466ea65a92 100644
@@ -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

#3 lore raw
Quoted 4 lines · Ming Qian

NXP Confidential

Avoid use "NXP Confidential" for public mail list.

Frank

#4 lore raw
In reply to Avi Weiss

From: Frank Li <[email protected]>

Quoted 9 lines · 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.

[...]

Applied, thanks!

[1/1] media: imx-jpeg: propagate encoder command errors

      commit: 9c309894703d7b539346d3a511ab4ca0ac30e952

Best regards,

Signature · 1 line
Frank Li <[email protected]>