diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2015-11-23 17:24:32 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-07 22:53:40 -0800 |
commit | 5fb437984b6c4793626be3936297fecece987a9f (patch) | |
tree | 4b62d02e635409ed584b6a3875cc6814801629fa | |
parent | fbaa72d56424553f0aa434d8816a0da7a9071415 (diff) | |
download | talos-obmc-linux-5fb437984b6c4793626be3936297fecece987a9f.tar.gz talos-obmc-linux-5fb437984b6c4793626be3936297fecece987a9f.zip |
misc: mic: use common error path
Instead of calling release_firmware() on every error and then jumping
lets have a common release_firmware() in the error path.
This patch also fixes a memory leak where we missed release_firmware()
if mic_x100_load_command_line() fails.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/mic/host/mic_x100.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/misc/mic/host/mic_x100.c b/drivers/misc/mic/host/mic_x100.c index 37fa89875e1e..82a973c85b5d 100644 --- a/drivers/misc/mic/host/mic_x100.c +++ b/drivers/misc/mic/host/mic_x100.c @@ -463,8 +463,7 @@ mic_x100_load_firmware(struct mic_device *mdev, const char *buf) rc = -EINVAL; dev_err(&mdev->pdev->dev, "%s %d rc %d bootaddr 0x%x\n", __func__, __LINE__, rc, mdev->bootaddr); - release_firmware(fw); - goto done; + goto error; } memcpy_toio(mdev->aper.va + mdev->bootaddr, fw->data, fw->size); mdev->ops->write_spad(mdev, MIC_X100_FW_SIZE, fw->size); @@ -472,22 +471,24 @@ mic_x100_load_firmware(struct mic_device *mdev, const char *buf) rc = -EINVAL; dev_err(&mdev->pdev->dev, "%s %d rc %d\n", __func__, __LINE__, rc); - release_firmware(fw); - goto done; + goto error; } /* load command line */ rc = mic_x100_load_command_line(mdev, fw); if (rc) { dev_err(&mdev->pdev->dev, "%s %d rc %d\n", __func__, __LINE__, rc); - goto done; + goto error; } release_firmware(fw); /* load ramdisk */ if (mdev->cosm_dev->ramdisk) rc = mic_x100_load_ramdisk(mdev); -done: + return rc; + +error: + release_firmware(fw); return rc; } |