[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f7e4b0be-fe09-4db8-b081-21c46c0d836f@moroto.mountain>
Date: Wed, 19 Jun 2024 10:21:45 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Jonas Karlman <jonas@...boo.se>
Cc: Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alex Bee <knaerzche@...il.com>,
Nicolas Dufresne <nicolas.dufresne@...labora.com>,
Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Sebastian Fricke <sebastian.fricke@...labora.com>,
Christopher Obbard <chris.obbard@...labora.com>,
Detlev Casanova <detlev.casanova@...labora.com>,
linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 08/10] media: rkvdec: Add image format concept
On Tue, Jun 18, 2024 at 07:46:32PM +0000, Jonas Karlman wrote:
> +static u32 rkvdec_enum_decoded_fmt(struct rkvdec_ctx *ctx, int index,
> + enum rkvdec_image_fmt image_fmt)
> {
> const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc;
> + unsigned int i, j;
>
> if (WARN_ON(!desc))
> return 0;
>
> - if (index >= desc->num_decoded_fmts)
> - return 0;
> + for (i = 0, j = 0; i < desc->num_decoded_fmts; i++) {
> + if (rkvdec_image_fmt_match(desc->decoded_fmts[i].image_fmt,
> + image_fmt) &&
> + index == j++)
I really don't care for this j++ which is tucked inside a condition.
> + return desc->decoded_fmts[i].fourcc;
> + }
int fmt_idx = -1;
unsigned int i;
for (i = 0, i < desc->num_decoded_fmts; i++) {
if (!rkvdec_image_fmt_match(desc->decoded_fmts[i].image_fmt,
image_fmt))
continue;
fmt_idx++;
if (index == fmt_idx)
return desc->decoded_fmts[i].fourcc;
}
return 0;
>
> - return desc->decoded_fmts[index];
> + return 0;
> }
Don't resend if this is the only issue, but if you do resend could you
get rid of the j++?
regards,
dan carpenter
Powered by blists - more mailing lists