diff mbox series

[3/4] sata: dwc_ahsata: Fix incorrect free

Message ID 20200503142703.14903-3-peng.fan@nxp.com
State New
Headers show
Series [1/4] sata: ahsata: Fix resource leak | expand

Commit Message

Peng Fan May 3, 2020, 2:27 p.m. UTC
From: Ye Li <ye.li at nxp.com>

Fix coverity issue CID 43665: Free of address-of expression (BAD_FREE)
incorrect_free: free frees incorrect pointer pp.

pp points the port array field of struct ahci_uc_priv, should not free it.

Acked-by: Peng Fan <peng.fan at nxp.com>
Signed-off-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/ata/dwc_ahsata.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Simon Glass May 4, 2020, 2:17 p.m. UTC | #1
On Sun, 3 May 2020 at 08:04, Peng Fan <peng.fan at nxp.com> wrote:
>
> From: Ye Li <ye.li at nxp.com>
>
> Fix coverity issue CID 43665: Free of address-of expression (BAD_FREE)
> incorrect_free: free frees incorrect pointer pp.
>
> pp points the port array field of struct ahci_uc_priv, should not free it.
>
> Acked-by: Peng Fan <peng.fan at nxp.com>
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>  drivers/ata/dwc_ahsata.c | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>
Tom Rini May 8, 2020, 10:59 p.m. UTC | #2
On Sun, May 03, 2020 at 10:27:02PM +0800, Peng Fan wrote:

> From: Ye Li <ye.li at nxp.com>
> 
> Fix coverity issue CID 43665: Free of address-of expression (BAD_FREE)
> incorrect_free: free frees incorrect pointer pp.
> 
> pp points the port array field of struct ahci_uc_priv, should not free it.
> 
> Acked-by: Peng Fan <peng.fan at nxp.com>
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c
index 4b37a02338..82fbb50da6 100644
--- a/drivers/ata/dwc_ahsata.c
+++ b/drivers/ata/dwc_ahsata.c
@@ -450,7 +450,6 @@  static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
 
 	mem = (u32)malloc(AHCI_PORT_PRIV_DMA_SZ + 1024);
 	if (!mem) {
-		free(pp);
 		printf("No mem for table!\n");
 		return -ENOMEM;
 	}