[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <65288fe9501236eaf4296f5841ca2d834d96c303.camel@mediatek.com>
Date: Thu, 13 Jun 2024 09:28:13 +0000
From: Yunfei Dong (董云飞) <Yunfei.Dong@...iatek.com>
To: "andrzej.p@...labora.com" <andrzej.p@...labora.com>
CC: "linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"frkoenig@...omium.org" <frkoenig@...omium.org>, "stevecho@...omium.org"
<stevecho@...omium.org>, "nhebert@...omium.org" <nhebert@...omium.org>,
"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"nicolas.dufresne@...labora.com" <nicolas.dufresne@...labora.com>,
"daniel@...ll.ch" <daniel@...ll.ch>, Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
"hverkuil-cisco@...all.nl" <hverkuil-cisco@...all.nl>,
"benjamin.gaignard@...labora.com" <benjamin.gaignard@...labora.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "hsinyi@...omium.org"
<hsinyi@...omium.org>, "angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>, "nfraprado@...labora.com"
<nfraprado@...labora.com>
Subject: Re: [PATCH 1/3] media: mediatek: vcodec: fix h264 multi statless
decoder smatch warning
Hi Andrzej,
Thanks for your help to review this patch.
On Wed, 2024-05-29 at 15:14 +0200, Andrzej Pietrasiewicz wrote:
> Hi,
>
> W dniu 3.04.2024 o 05:45, Yunfei Dong (董云飞) pisze:
> > Hi AngeloGioacchino,
> >
> > Thanks for your reviewing.
> > On Tue, 2024-04-02 at 11:50 +0200, AngeloGioacchino Del Regno
> > wrote:
> > > Il 29/02/24 10:56, Yunfei Dong ha scritto:
> > > > Fix smatch static checker warning for vdec_h264_req_multi_if.c.
> > > > Leading to kernel crash when fb is NULL.
> > > >
> > > > Fixes: 397edc703a10 ("media: mediatek: vcodec: add h264
> > > > decoder")
> > > > Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
> > > > ---
> > > > .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 9
> > > > +++++++--
> > > > 1 file changed, 7 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git
> > > > a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264
> > > > _req
> > > > _multi_if.c
> > > > b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264
> > > > _req
> > > > _multi_if.c
> > > > index 0e741e0dc8ba..ab8e708e0df1 100644
> > > > ---
> > > > a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264
> > > > _req
> > > > _multi_if.c
> > > > +++
> > > > b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264
> > > > _req
> > > > _multi_if.c
> > > > @@ -724,11 +724,16 @@ static int
> > > > vdec_h264_slice_single_decode(void
> > > > *h_vdec, struct mtk_vcodec_mem *bs
> > > > return vpu_dec_reset(vpu);
> > > >
> > > > fb = inst->ctx->dev->vdec_pdata->get_cap_buffer(inst-
> > > > >ctx);
> > > > + if (!fb) {
> > > > + mtk_vdec_err(inst->ctx, "fb buffer is NULL");
> > > > + return -EBUSY;
> > > > + }
> > > > +
> > > > src_buf_info = container_of(bs, struct
> > > > mtk_video_dec_buf,
> > > > bs_buffer);
> > > > dst_buf_info = container_of(fb, struct
> > > > mtk_video_dec_buf,
> > > > frame_buffer);
> > > >
> > > > - y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
> > > > - c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
> > >
> > > You're changing the behavior here, can you please explain why
> > > this
> > > change is valid
> > > into the commit description?
> > >
> >
> > The driver already add the condition to check whether fb is NULL at
> > the
> > front, no need these two lines again.
> >
>
> Maybe Angelo refers to the function never returning -EBUSY before?
> While at it, if fb is a kind of a buffer, why not -ENOMEM
> when get_cap_buffer() fails?
>
Looks change the return value from EBUSY to ENOMEM much more
reasonable.
> Regards,
>
> Andrzej
>
Best Regards,
Yunfei Dong
> > > Thanks,
> > > Angelo
> > >
> >
> > Best Regards,
> > Yunfei Dong
> > > > + y_fb_dma = (u64)fb->base_y.dma_addr;
> > > > + c_fb_dma = (u64)fb->base_c.dma_addr;
> > > > mtk_vdec_debug(inst->ctx, "[h264-dec] [%d] y_dma=%llx
> > > > c_dma=%llx",
> > > > inst->ctx->decoded_frame_cnt, y_fb_dma,
> > > > c_fb_dma);
> > > >
> > >
> > >
> > >
>
>
Powered by blists - more mailing lists