[PATCH 08/12] imx-usb-loader: drop some casting
Sascha Hauer
s.hauer at pengutronix.de
Thu Jul 14 00:27:18 PDT 2022
Instead of casting 'bd' to struct imx_boot_data * multiple times use
an extra variable for it.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
scripts/imx/imx-usb-loader.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 974ff741bf..b2c835225c 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -1258,19 +1258,22 @@ static int get_dl_start(const unsigned char *p, const unsigned char *file_start,
}
case HDR_MX53:
{
- unsigned char *bd;
+ unsigned char *_bd;
struct imx_flash_header_v2 *hdr = (struct imx_flash_header_v2 *)p;
+ struct imx_boot_data *bd;
*header_addr = hdr->self;
- bd = hdr->boot_data_ptr + cvt_dest_to_src;
- if ((bd < file_start) || ((bd + 4) > file_end)) {
+ _bd = hdr->boot_data_ptr + cvt_dest_to_src;
+ if ((_bd < file_start) || ((_bd + 4) > file_end)) {
printf("bad boot_data_ptr %08x\n", hdr->boot_data_ptr);
return -1;
}
- *firststage_len = ((struct imx_boot_data *)bd)->size;
- *plugin = ((struct imx_boot_data *)bd)->plugin;
- ((struct imx_boot_data *)bd)->plugin = 0;
+ bd = (void *)_bd;
+
+ *firststage_len = bd->size;
+ *plugin = bd->plugin;
+ bd->plugin = 0;
break;
}
--
2.30.2
More information about the barebox
mailing list