[PATCHv2] staging: gs_fpgaboot: remove redundant code
Gujulan Elango, Hari Prasath (H.)
hgujulan at visteon.com
Thu May 28 10:51:38 UTC 2015
remove redundant code in this function.remove return value check for
function that always return success.
Signed-off-by: Gujulan Elango Hari Prasath <hgujulan at visteon.com>
---
v2:address review comments from Dan.Remove return value check
for the function gs_release_image as it always returns success and
rearrange the code accordingly.Also delete debug messages.
---
drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 44 ++++++++-----------------------
1 file changed, 11 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index a3a10f9..a792c1a 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -288,7 +288,7 @@ static void finish_driver(void)
static int gs_fpgaboot(void)
{
- int err;
+ int err = 0;
struct fpgaimage *fimage;
fimage = kmalloc(sizeof(struct fpgaimage), GFP_KERNEL);
@@ -296,47 +296,25 @@ static int gs_fpgaboot(void)
return -ENOMEM;
err = gs_load_image(fimage, file);
- if (err) {
- pr_err("gs_load_image error\n");
- goto err_out1;
- }
+ if (err)
+ goto free_image;
err = gs_read_image(fimage);
- if (err) {
- pr_err("gs_read_image error\n");
- goto err_out2;
- }
+ if (err)
+ goto release_image;
err = gs_set_download_method(fimage);
- if (err) {
- pr_err("gs_set_download_method error\n");
- goto err_out2;
- }
+ if (err)
+ goto release_image;
err = gs_download_image(fimage, bus_2byte);
- if (err) {
- pr_err("gs_download_image error\n");
- goto err_out2;
- }
-
- err = gs_release_image(fimage);
- if (err) {
- pr_err("gs_release_image error\n");
- goto err_out1;
- }
-
- kfree(fimage);
- return 0;
-err_out2:
- err = gs_release_image(fimage);
- if (err)
- pr_err("gs_release_image error\n");
-err_out1:
+release_image:
+ gs_release_image(fimage);
+free_image:
kfree(fimage);
- return -1;
-
+ return err;
}
static int __init gs_fpgaboot_init(void)
--
1.9.1
More information about the devel
mailing list