Commit 502defbb authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Benjamin Herrenschmidt

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: 6a794a27 ("fsi: master-ast-cf: Add new FSI master using Aspeed ColdFire")
Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 375cac70
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment