diff options
author | Sean Anderson | 2022-08-16 11:16:06 -0400 |
---|---|---|
committer | Peng Fan | 2022-09-07 13:40:50 +0800 |
commit | f1061c570112670be3259fff7966caad96c6e2cf (patch) | |
tree | cced63dde733e92c7bfb57db2db4dbe2cd3adf2d /drivers/net/pfe_eth/pfe_firmware.c | |
parent | 7b42bde075c9cec85aa200d2e093d3b2b5641d94 (diff) |
net: Convert fit verification to use fit_get_data_*
Several ethernet drivers load firmware from FIT images. Convert them to
use the fit_get_data helpers.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'drivers/net/pfe_eth/pfe_firmware.c')
-rw-r--r-- | drivers/net/pfe_eth/pfe_firmware.c | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/drivers/net/pfe_eth/pfe_firmware.c b/drivers/net/pfe_eth/pfe_firmware.c index 82a4aa89a4d..da4f2ca42a5 100644 --- a/drivers/net/pfe_eth/pfe_firmware.c +++ b/drivers/net/pfe_eth/pfe_firmware.c @@ -104,45 +104,7 @@ err: static int pfe_get_fw(const void **data, size_t *size, char *fw_name) { - int conf_node_off, fw_node_off; - char *conf_node_name = NULL; - char *desc; - int ret = 0; - - conf_node_name = PFE_FIRMWARE_FIT_CNF_NAME; - - conf_node_off = fit_conf_get_node(pfe_fit_addr, conf_node_name); - if (conf_node_off < 0) { - printf("PFE Firmware: %s: no such config\n", conf_node_name); - return -ENOENT; - } - - fw_node_off = fit_conf_get_prop_node(pfe_fit_addr, conf_node_off, - fw_name); - if (fw_node_off < 0) { - printf("PFE Firmware: No '%s' in config\n", - fw_name); - return -ENOLINK; - } - - if (!(fit_image_verify(pfe_fit_addr, fw_node_off))) { - printf("PFE Firmware: Bad firmware image (bad CRC)\n"); - return -EINVAL; - } - - if (fit_image_get_data(pfe_fit_addr, fw_node_off, data, size)) { - printf("PFE Firmware: Can't get %s subimage data/size", - fw_name); - return -ENOENT; - } - - ret = fit_get_desc(pfe_fit_addr, fw_node_off, &desc); - if (ret) - printf("PFE Firmware: Can't get description\n"); - else - printf("%s\n", desc); - - return ret; + return fit_get_data_conf_prop(pfe_fit_addr, fw_name, data, size); } /* |