diff mbox series

[1/5] drm/mediatek: Remove freeing not dynamic allocated memory

Message ID 20230407064657.12350-2-jason-jh.lin@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Fix mediatek-drm coverity issues | expand

Commit Message

Jason-JH Lin (林睿祥) April 7, 2023, 6:46 a.m. UTC
Fixing the coverity issue of:
mtk_drm_cmdq_pkt_destroy frees address of mtk_crtc->cmdq_handle

So remove the free function.

Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Fixes: 7627122fd1c0 ("drm/mediatek: Add cmdq_handle in mtk_crtc")
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 -
 1 file changed, 1 deletion(-)

Comments

CK Hu (胡俊光) June 12, 2023, 8:06 a.m. UTC | #1
Hi, Jason:

On Fri, 2023-04-07 at 14:46 +0800, Jason-JH.Lin wrote:
> Fixing the coverity issue of:
> mtk_drm_cmdq_pkt_destroy frees address of mtk_crtc->cmdq_handle
> 
> So remove the free function.
> 
> Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> Fixes: 7627122fd1c0 ("drm/mediatek: Add cmdq_handle in mtk_crtc")
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 4bc45cdbddf1..c7b03e564095 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -148,7 +148,6 @@ static void mtk_drm_cmdq_pkt_destroy(struct
> cmdq_pkt *pkt)
>  	dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt-
> >buf_size,
>  			 DMA_TO_DEVICE);
>  	kfree(pkt->va_base);
> -	kfree(pkt);


Also fix the same problem in mtk_drm_cmdq_pkt_create().

Regards,
CK

>  }
>  #endif
>
Jason-JH Lin (林睿祥) June 13, 2023, 7:06 a.m. UTC | #2
Hi CK,

Thanks for the reviews.

On Mon, 2023-06-12 at 08:06 +0000, CK Hu (胡俊光) wrote:
> Hi, Jason:
> 
> On Fri, 2023-04-07 at 14:46 +0800, Jason-JH.Lin wrote:
> > Fixing the coverity issue of:
> > mtk_drm_cmdq_pkt_destroy frees address of mtk_crtc->cmdq_handle
> > 
> > So remove the free function.
> > 
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > Fixes: 7627122fd1c0 ("drm/mediatek: Add cmdq_handle in mtk_crtc")
> > ---
> >  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > index 4bc45cdbddf1..c7b03e564095 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > @@ -148,7 +148,6 @@ static void mtk_drm_cmdq_pkt_destroy(struct
> > cmdq_pkt *pkt)
> >  	dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt-
> > > buf_size,
> > 
> >  			 DMA_TO_DEVICE);
> >  	kfree(pkt->va_base);
> > -	kfree(pkt);
> 
> 
> Also fix the same problem in mtk_drm_cmdq_pkt_create().
> 
> Regards,
> CK

OK, I'll also fix them. Thanks for the reminder.

Regards,
Jason-JH.Lin
> 
> >  }
> >  #endif
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 4bc45cdbddf1..c7b03e564095 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -148,7 +148,6 @@  static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)
 	dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
 			 DMA_TO_DEVICE);
 	kfree(pkt->va_base);
-	kfree(pkt);
 }
 #endif