[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180725133832.GA20837@embeddedor.com>
Date: Wed, 25 Jul 2018 08:38:32 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
linux-kernel@...r.kernel.org
Cc: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: [PATCH] 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@...eddedor.com>
---
drivers/fsi/fsi-master-ast-cf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c
index c4a3557..e39a4630 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;
}
--
2.7.4
Powered by blists - more mailing lists