[PATCH v7 7/7] media: nuvoton: Add driver for NPCM video capture and encode engine
Kun-Fa Lin
milkfafa at gmail.com
Thu Nov 24 14:30:31 AEDT 2022
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
More information about the openbmc
mailing list