summaryrefslogtreecommitdiffstats
path: root/drivers/fsi/fsi-master-ast-cf.c
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2018-07-25 08:38:32 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-07-26 09:56:17 +1000
commit502defbb476bca222ddb5a78f2cc19c12c4e42f3 (patch)
treebca28ddb1ee758fa00fbe9aa828e6768ce71611f /drivers/fsi/fsi-master-ast-cf.c
parent375cac70100b58ce8f4737ec530bfbdcb3086964 (diff)
downloadtalos-op-linux-502defbb476bca222ddb5a78f2cc19c12c4e42f3.tar.gz
talos-op-linux-502defbb476bca222ddb5a78f2cc19c12c4e42f3.zip
fsi: master-ast-cf: Fix memory leak
In case memory resources for *fw* were allocated, release them before return. Addresses-Coverity-ID: 1472044 ("Resource leak") Fixes: 6a794a27daca ("fsi: master-ast-cf: Add new FSI master using Aspeed ColdFire") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/fsi/fsi-master-ast-cf.c')
-rw-r--r--drivers/fsi/fsi-master-ast-cf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c
index b59abcf3ee32..6a36220e4b40 100644
--- a/drivers/fsi/fsi-master-ast-cf.c
+++ b/drivers/fsi/fsi-master-ast-cf.c
@@ -861,7 +861,8 @@ static int load_copro_firmware(struct fsi_master_acf *master)
if (sig != wanted_sig) {
dev_err(master->dev, "Failed to locate image sig %04x in FW blob\n",
wanted_sig);
- return -ENODEV;
+ rc = -ENODEV;
+ goto release_fw;
}
if (size > master->cf_mem_size) {
dev_err(master->dev, "FW size (%zd) bigger than memory reserve (%zd)\n",
@@ -870,8 +871,9 @@ static int load_copro_firmware(struct fsi_master_acf *master)
} else {
memcpy_toio(master->cf_mem, data, size);
}
- release_firmware(fw);
+release_fw:
+ release_firmware(fw);
return rc;
}
OpenPOWER on IntegriCloud