From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A5B8222576; Mon, 23 Jun 2025 22:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750716691; cv=none; b=QBK7snUbaRiB7P1+7iCI05ElsJiivkuxfspPUdXvKjXJcXpDDI1480GA/wnJhqP32fUUU6RPpjxDWi/Llf1yvZ70tF6ZxLJ92+4alGLiO/g1eisfJz4c2jOie38+QRfzxxqQEuwzalmyc7oSo4qCXuAP+m5izP8LBRSQJ1JQsvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750716691; c=relaxed/simple; bh=1MHJOeyTuDcvZfDB7kFfun72JrjXM2taxWXZ3j3xI/s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gr8g68lLZ9V3Jt6KZ0nKmJMX4tnhp4R87X6vKXbqY3Z5DYDc8tJT++DK40fdyvM2XI50NTq8EYIfoOiQiIPns4f8pRwZS3v2gHurnt2ZXWYNuuTguI71MKMFWpH8IcJy+qqbNCK8/kDafPC/R+VsTPjsnI57DRzHrYgG29r89wQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yi8sgtQY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yi8sgtQY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2AA5C4CEEA; Mon, 23 Jun 2025 22:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750716691; bh=1MHJOeyTuDcvZfDB7kFfun72JrjXM2taxWXZ3j3xI/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yi8sgtQY/xUeKVD56zd9G3pNylQ253k9zOWCSJ+/U9lLBdgHZ2+JGSgyGx6GrMnQS qA7n+WUT4/FezRG/2/JCwZmAeUPZrsQPyjN1S61VRat1tXEOROKTTOOlQcUoxBW48+ E0IMRF1iK1OUzHEu5NGB2PITTiQBVSFM1LJR3TTA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ming Qian , Nicolas Dufresne , Hans Verkuil Subject: [PATCH 6.1 321/508] media: imx-jpeg: Drop the first error frames Date: Mon, 23 Jun 2025 15:06:06 +0200 Message-ID: <20250623130653.225491265@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130645.255320792@linuxfoundation.org> References: <20250623130645.255320792@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Qian commit d52b9b7e2f10d22a49468128540533e8d76910cd upstream. When an output buffer contains error frame header, v4l2_jpeg_parse_header() will return error, then driver will mark this buffer and a capture buffer done with error flag in device_run(). But if the error occurs in the first frames, before setup the capture queue, there is no chance to schedule device_run(), and there may be no capture to mark error. So we need to drop this buffer with error flag, and make the decoding can continue. Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder") Cc: stable@vger.kernel.org Signed-off-by: Ming Qian Reviewed-by: Nicolas Dufresne Signed-off-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -1468,9 +1468,19 @@ static void mxc_jpeg_buf_queue(struct vb jpeg_src_buf = vb2_to_mxc_buf(vb); jpeg_src_buf->jpeg_parse_error = false; ret = mxc_jpeg_parse(ctx, vb); - if (ret) + if (ret) { jpeg_src_buf->jpeg_parse_error = true; + /* + * if the capture queue is not setup, the device_run() won't be scheduled, + * need to drop the error buffer, so that the decoding can continue + */ + if (!vb2_is_streaming(v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx))) { + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); + return; + } + } + end: v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); }