summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2021-08-13 10:17:10 +0300
committerMichal Simek <michal.simek@xilinx.com>2021-08-26 09:14:43 +0300
commitb262863bf8881542b7fad73563b3d6827df3f4b7 (patch)
tree48fcd9a221c6dd79047fd5e61cedcbbe51e73e1b /board
parentd9c93c9e2c53e5b624e79b9ba244f84b5c73544b (diff)
downloadu-boot-b262863bf8881542b7fad73563b3d6827df3f4b7.tar.xz
xilinx: common: Free allocated structure
There is no need to keep fru_content around. Free this space. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board')
-rw-r--r--board/xilinx/common/board.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 44c8aa5eef..2aecb14d8e 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -185,8 +185,7 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
eeprom_size);
if (ret) {
debug("%s: I2C EEPROM read failed\n", __func__);
- free(fru_content);
- return ret;
+ goto end;
}
printf("Xilinx I2C FRU format at %s:\n", name);
@@ -194,12 +193,13 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
ret = fru_display(0);
if (ret) {
printf("FRU format decoding failed.\n");
- return ret;
+ goto end;
}
if (desc->header == EEPROM_HEADER_MAGIC) {
debug("Information already filled\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto end;
}
/* It is clear that FRU was captured and structures were filled */
@@ -217,7 +217,9 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
sizeof(desc->serial));
desc->header = EEPROM_HEADER_MAGIC;
- return 0;
+end:
+ free(fru_content);
+ return ret;
}
static bool xilinx_detect_fru(u8 *buffer)