mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 08/12] imx-usb-loader: drop some casting
Date: Thu, 14 Jul 2022 09:27:18 +0200	[thread overview]
Message-ID: <20220714072722.2863571-9-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20220714072722.2863571-1-s.hauer@pengutronix.de>

Instead of casting 'bd' to struct imx_boot_data * multiple times use
an extra variable for it.

Signed-off-by: Sascha Hauer <s.hauer@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




  parent reply	other threads:[~2022-07-14  7:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  7:27 [PATCH 00/12] imx-usb-loader support for i.MX8MP Sascha Hauer
2022-07-14  7:27 ` [PATCH 01/12] ARM: i.MX8MM: Prepare loading only piggydata in imx-usb-loader Sascha Hauer
2022-07-14  7:27 ` [PATCH 02/12] ARM: i.MX8M: Add romapi support Sascha Hauer
2022-07-14  7:27 ` [PATCH 03/12] ARM: i.MX8MP: Add common code to load image and jump to it via TF-A Sascha Hauer
2022-07-14  7:27 ` [PATCH 04/12] ARM: i.MX8MP-EVK: Use imx8mp_load_and_start_image_via_tfa() Sascha Hauer
2022-07-14  7:27 ` [PATCH 05/12] imx-usb-loader: Factor out common code to function Sascha Hauer
2022-07-14  7:27 ` [PATCH 06/12] imx-usb-loader: rename mxs functions Sascha Hauer
2022-07-14  7:27 ` [PATCH 07/12] imx-usb-loader: Add i.MX8MP support Sascha Hauer
2022-07-29  9:33   ` Marco Felsch
2022-08-08 12:20     ` Sascha Hauer
2022-07-14  7:27 ` Sascha Hauer [this message]
2022-07-14  7:27 ` [PATCH 09/12] imx-usb-loader: Fix first stage length Sascha Hauer
2022-07-14  7:27 ` [PATCH 10/12] imx-usb-loader: simplify read_memory() Sascha Hauer
2022-07-14  7:27 ` [PATCH 11/12] imx-usb-loader: verify correct image length Sascha Hauer
2022-07-14  7:27 ` [PATCH 12/12] imx-usb-loader: drop some unnecessary casting Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220714072722.2863571-9-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH 08/12] imx-usb-loader: drop some casting' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox