[bug report] media: nuvoton: Add driver for NPCM video capture and encoding engine

Kun-Fa Lin milkfafa at gmail.com
Wed Sep 27 22:09:36 AEST 2023


Hi Dan,

> > On 26/09/2023 16:23, Dan Carpenter wrote:
> > > Hello Marvin Lin,
> > >
> > > The patch 70721089985c: "media: nuvoton: Add driver for NPCM video
> > > capture and encoding engine" from Sep 22, 2023 (linux-next), leads to
> > > the following Smatch static checker warning:
> > >
> > >     drivers/media/platform/nuvoton/npcm-video.c:1004 npcm_video_raw()
> > >     warn: sleeping in atomic context
> >
> > Hmm, why didn't my smatch run see this? Does this check require something
> > special? Does it rely on having run build_kernel_data.sh?
>
> Yep.  It relies on build_kernel_data.sh.  Otherwise it that code is all
> released.

I can see these warnings after running build_kernel_data.sh:
drivers/media/platform/nuvoton/npcm-video.c:1004 npcm_video_raw()
warn: sleeping in atomic context
drivers/media/platform/nuvoton/npcm-video.c:1089 npcm_video_irq()
warn: sleeping in atomic context

I'll send below patch to fix them, thanks for the bug report.

--- a/drivers/media/platform/nuvoton/npcm-video.c
+++ b/drivers/media/platform/nuvoton/npcm-video.c
@@ -412,7 +412,7 @@ static unsigned int npcm_video_add_rect(struct
npcm_video *video,
        struct rect_list *list = NULL;
        struct v4l2_rect *r;

-       list = kzalloc(sizeof(*list), GFP_KERNEL);
+       list = kzalloc(sizeof(*list), GFP_ATOMIC);
        if (!list)
                return 0;

@@ -467,7 +467,7 @@ static struct rect_list
*npcm_video_new_rect(struct npcm_video *video,
        struct rect_list *list = NULL;
        struct v4l2_rect *r;

-       list = kzalloc(sizeof(*list), GFP_KERNEL);
+       list = kzalloc(sizeof(*list), GFP_ATOMIC);
        if (!list)
                return NULL;

Regards,
Marvin


More information about the openbmc mailing list