MLK-14930-2 dwc_ahsata: Fix memory issue in reset_sata
authorYe Li <ye.li@nxp.com>
Tue, 27 Mar 2018 07:45:10 +0000 (00:45 -0700)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:28 +0000 (04:28 -0700)
The reset_sata should reset the sata device info and free the probe_ent
memory. Otherwise, it will cause memory leak if we init the sata again.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 148488728486137a790a89e9b869cc938c3e0c57)

drivers/ata/dwc_ahsata.c

index 4c5b984..8cac99e 100644 (file)
@@ -920,6 +920,9 @@ int reset_sata(int dev)
        while (readl(&host_mmio->ghc) & SATA_HOST_GHC_HR)
                udelay(100);
 
+       free(uc_priv);
+       memset(&sata_dev_desc[dev], 0, sizeof(struct blk_desc));
+
        return 0;
 }