summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLuo Ji <ji.luo@nxp.com>2019-03-14 17:02:25 +0800
committerJi Luo <ji.luo@nxp.com>2019-03-15 12:25:37 +0800
commitff1364165cbc0a19d554158995bdd9c3ccd0cc20 (patch)
treef2e2b0a531a38d33a5fb2ed58585616e5977dcd7 /drivers
parent35599c12090d3e52576d41acfb2b81c16811e4f5 (diff)
MA-14379 [coverity] Resource leak (RESOURCE_LEAK)
Fix coverity issue: CID 2970630: Resource leak (RESOURCE_LEAK) leaked_storage: Variable cdns going out of scope leaks the storage it points to. Memory allocated by devm_kzalloc() won't be freed automatically in u-boot, free the memory manually here. Test: Coverity scan pass. Change-Id: I3000a2385941cef3b8b7e01611cfdc999971a4ca Signed-off-by: Luo Ji <ji.luo@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/cdns3/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index cdea627a6c..8495fec7ea 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -333,6 +333,11 @@ err2:
cdns3_remove_roles(cdns);
err1:
cdns3_disable_clks(cdns->index);
+
+ /* For u-boot, need to free the memory manually here. */
+ if (cdns != NULL)
+ free(cdns);
+
return ret;
}