summaryrefslogtreecommitdiff
path: root/drivers/mcb/mcb-parse.c
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2017-08-29 14:47:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-31 18:49:41 +0200
commit5ec6bff199f27c85a37443a854f7c9f1a8c94a9d (patch)
tree6bb5d47702d3050f460b4225d21d3ce8bd8edfc3 /drivers/mcb/mcb-parse.c
parentacf5e051ac44d5dc60b21bc4734ef1b844d55551 (diff)
mcb: Fix an error handling path in 'chameleon_parse_cells()'
If 'chameleon_get_bar()' fails, we will return 0, which mean success. We should return the corresponding error code instead. Remove the useless initialisation of 'ret' which was hiding the issue. (if 'ret' is not set, gcc generates a warning ("warning: ‘ret’ may be used uninitialized in this function")) Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mcb/mcb-parse.c')
-rw-r--r--drivers/mcb/mcb-parse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mcb/mcb-parse.c b/drivers/mcb/mcb-parse.c
index ee7fb6ec96bd..7369bda3442f 100644
--- a/drivers/mcb/mcb-parse.c
+++ b/drivers/mcb/mcb-parse.c
@@ -182,7 +182,7 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
int num_cells = 0;
uint32_t dtype;
int bar_count;
- int ret = 0;
+ int ret;
u32 hsize;
hsize = sizeof(struct chameleon_fpga_header);
@@ -210,8 +210,10 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
header->filename);
bar_count = chameleon_get_bar(&p, mapbase, &cb);
- if (bar_count < 0)
+ if (bar_count < 0) {
+ ret = bar_count;
goto free_header;
+ }
for_each_chameleon_cell(dtype, p) {
switch (dtype) {