Skip to content

Commit 27b9e2e

Browse files
Jason-JH.LinChun-Kuang Hu
authored andcommitted
drm/mediatek: Remove freeing not dynamic allocated memory
Fixing the coverity issue of: mtk_drm_cmdq_pkt_destroy frees address of mtk_crtc->cmdq_handle So remove the free function. Fixes: 7627122 ("drm/mediatek: Add cmdq_handle in mtk_crtc") Signed-off-by: Jason-JH.Lin <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: CK Hu <[email protected]> Reviewed-by: Alexandre Mergnat <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent b3af12a commit 27b9e2e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/gpu/drm/mediatek/mtk_drm_crtc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,9 @@ static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *
116116
dma_addr_t dma_addr;
117117

118118
pkt->va_base = kzalloc(size, GFP_KERNEL);
119-
if (!pkt->va_base) {
120-
kfree(pkt);
119+
if (!pkt->va_base)
121120
return -ENOMEM;
122-
}
121+
123122
pkt->buf_size = size;
124123
pkt->cl = (void *)client;
125124

@@ -129,7 +128,6 @@ static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *
129128
if (dma_mapping_error(dev, dma_addr)) {
130129
dev_err(dev, "dma map failed, size=%u\n", (u32)(u64)size);
131130
kfree(pkt->va_base);
132-
kfree(pkt);
133131
return -ENOMEM;
134132
}
135133

@@ -145,7 +143,6 @@ static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)
145143
dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
146144
DMA_TO_DEVICE);
147145
kfree(pkt->va_base);
148-
kfree(pkt);
149146
}
150147
#endif
151148

0 commit comments

Comments
 (0)