[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnNmFqKt_gVO8zonD3DYvM4PazKjKOgE2j_X8jZjSn9Pc9HzA@mail.gmail.com>
Date: Thu, 24 Nov 2022 11:30:31 +0800
From: Kun-Fa Lin <milkfafa@...il.com>
To: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
Cc: mchehab@...nel.org, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
openbmc@...ts.ozlabs.org, avifishman70@...il.com,
tmaimon77@...il.com, tali.perry1@...il.com, kwliu@...oton.com,
kflin@...oton.com
Subject: Re: [PATCH v7 7/7] media: nuvoton: Add driver for NPCM video capture
and encode engine
Hi Andrzej,
Thanks for the review.
> > +#define GPLLST 0x48
> > +#define GPLLST_PLLOTDIV1 GENMASK(2, 0)
> > +#define GPLLST_PLLOTDIV2 GENMASK(5, 3)
> > +#define GPLLST_GPLLFBDV109 GENMASK(7, 6)
> > +
>
> There's a bunch of register definitions. Given you're adding a dedicated
> directory for nuvoton maybe it makes sense to factor these definitions
> out to a local header file?
Agreed. I'll move these definitions out to a local header file in the
next patch.
> > + for (i = 0; i < video->num_buffers; i++) {
> > + head = &video->list[i];
> > + list_for_each_safe(pos, nx, head) {
> > + tmp = list_entry(pos, struct rect_list, list);
>
> If we ever get here isn't pos guaranteed to be non-NULL?
> And so consequently is tmp.
>
> > + if (tmp) {
>
> Then this condition is always true?
Indeed the condition is always true, will remove the condition check.
> > + video->rect = kcalloc(*num_buffers, sizeof(*video->rect), GFP_KERNEL);
>
> In practice "small allocations never fail", but what if kcalloc fails some day?
>
> > +
> > + if (video->list) {
> > + npcm_video_free_diff_table(video);
> > + kfree(video->list);
> > + video->list = NULL;
> > + }
> > +
> > + video->list = kzalloc(sizeof(*video->list) * *num_buffers, GFP_KERNEL);
>
> Or kzalloc?
Will add error handling.
> In this function there are 3 similar error recovery paths. Can nice "goto"s
> be introduced to handle them?
Will do it for sure.
Regards,
Marvin
Powered by blists - more mailing lists