[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e72fb6fb-4dcd-4fb4-9d44-d8de3c5ffe30@kwiboo.se>
Date: Thu, 27 Jun 2024 11:39:28 +0200
From: Jonas Karlman <jonas@...boo.se>
To: Dan Carpenter <dan.carpenter@...aro.org>
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
Hi Dan,
On 2024-06-19 09:21, Dan Carpenter wrote:
> 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++?
Thanks, I will send a v6 later today/tomorrow and will include your
proposed change.
Regards,
Jonas
>
> regards,
> dan carpenter
Powered by blists - more mailing lists