public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] FIT: delete unnecessary casts
@ 2013-09-19  3:10 Masahiro Yamada
  2013-09-19 17:22 ` Jeroen Hofstee
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2013-09-19  3:10 UTC (permalink / raw)
  To: u-boot

Becuase fdt_check_header function takes (const void *)
type argument, the argument should be passed to it
without being casted to (char *).

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Changes for v2:
   - fix commit log (purely cosmetic)
         (s/img_addr/the argument/)


 common/image-fdt.c | 2 +-
 common/image-fit.c | 2 +-
 common/image.c     | 6 +-----
 tools/fit_image.c  | 2 +-
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 2e22cca..6f9ce7d 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -55,7 +55,7 @@ static const image_header_t *image_get_fdt(ulong fdt_addr)
 		fdt_error("uImage is compressed");
 		return NULL;
 	}
-	if (fdt_check_header((char *)image_get_data(fdt_hdr)) != 0) {
+	if (fdt_check_header((void *)image_get_data(fdt_hdr)) != 0) {
 		fdt_error("uImage data is not a fdt");
 		return NULL;
 	}
diff --git a/common/image-fit.c b/common/image-fit.c
index 1c2ef31..a657c13 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1596,7 +1596,7 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
 	len = (ulong)size;
 
 	/* verify that image data is a proper FDT blob */
-	if (image_type == IH_TYPE_FLATDT && fdt_check_header((char *)buf)) {
+	if (image_type == IH_TYPE_FLATDT && fdt_check_header(buf)) {
 		puts("Subimage data is not a FDT");
 		return -ENOEXEC;
 	}
diff --git a/common/image.c b/common/image.c
index 2c88091..e0a4c12 100644
--- a/common/image.c
+++ b/common/image.c
@@ -652,17 +652,13 @@ int genimg_get_format(const void *img_addr)
 {
 	ulong format = IMAGE_FORMAT_INVALID;
 	const image_header_t *hdr;
-#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
-	char *fit_hdr;
-#endif
 
 	hdr = (const image_header_t *)img_addr;
 	if (image_check_magic(hdr))
 		format = IMAGE_FORMAT_LEGACY;
 #if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
 	else {
-		fit_hdr = (char *)img_addr;
-		if (fdt_check_header(fit_hdr) == 0)
+		if (fdt_check_header(img_addr) == 0)
 			format = IMAGE_FORMAT_FIT;
 	}
 #endif
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 47beaaf..0400a60 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -23,7 +23,7 @@ static image_header_t header;
 static int fit_verify_header (unsigned char *ptr, int image_size,
 			struct mkimage_params *params)
 {
-	return fdt_check_header ((void *)ptr);
+	return fdt_check_header(ptr);
 }
 
 static int fit_check_image_types (uint8_t type)
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] FIT: delete unnecessary casts
  2013-09-19  3:10 [U-Boot] [PATCH v2] FIT: delete unnecessary casts Masahiro Yamada
@ 2013-09-19 17:22 ` Jeroen Hofstee
  2013-09-21  1:59 ` Simon Glass
  2013-09-21 12:07 ` [U-Boot] [U-Boot,v2] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Jeroen Hofstee @ 2013-09-19 17:22 UTC (permalink / raw)
  To: u-boot

On 09/19/2013 05:10 AM, Masahiro Yamada wrote:
> Becuase fdt_check_header function takes (const void *)
> type argument, the argument should be passed to it
> without being casted to (char *).
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
>
> Changes for v2:
>     - fix commit log (purely cosmetic)
>           (s/img_addr/the argument/)
>
>
>   common/image-fdt.c | 2 +-
>   common/image-fit.c | 2 +-
>   common/image.c     | 6 +-----
>   tools/fit_image.c  | 2 +-
>   4 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/common/image-fdt.c b/common/image-fdt.c
> index 2e22cca..6f9ce7d 100644
> --- a/common/image-fdt.c
> +++ b/common/image-fdt.c
> @@ -55,7 +55,7 @@ static const image_header_t *image_get_fdt(ulong fdt_addr)
>   		fdt_error("uImage is compressed");
>   		return NULL;
>   	}
> -	if (fdt_check_header((char *)image_get_data(fdt_hdr)) != 0) {
> +	if (fdt_check_header((void *)image_get_data(fdt_hdr)) != 0) {
>   		fdt_error("uImage data is not a fdt");
>   		return NULL;
>   	}


Not that I care, this is fine with me. Was just
wondering if this cast is needed at all. AFAIK
it is a cpp thing (and MSVC?) to require it.

Regards,
Jeroen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] FIT: delete unnecessary casts
  2013-09-19  3:10 [U-Boot] [PATCH v2] FIT: delete unnecessary casts Masahiro Yamada
  2013-09-19 17:22 ` Jeroen Hofstee
@ 2013-09-21  1:59 ` Simon Glass
  2013-09-21 12:07 ` [U-Boot] [U-Boot,v2] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2013-09-21  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 18, 2013 at 9:10 PM, Masahiro Yamada
<yamada.m@jp.panasonic.com>wrote:

> Becuase fdt_check_header function takes (const void *)
> type argument, the argument should be passed to it
> without being casted to (char *).
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
>

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [U-Boot,v2] FIT: delete unnecessary casts
  2013-09-19  3:10 [U-Boot] [PATCH v2] FIT: delete unnecessary casts Masahiro Yamada
  2013-09-19 17:22 ` Jeroen Hofstee
  2013-09-21  1:59 ` Simon Glass
@ 2013-09-21 12:07 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2013-09-21 12:07 UTC (permalink / raw)
  To: u-boot

On Thu, Sep 19, 2013 at 12:10:18PM +0900, Masahiro Yamada wrote:

> Becuase fdt_check_header function takes (const void *)
> type argument, the argument should be passed to it
> without being casted to (char *).
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130921/b1c6ab75/attachment.pgp>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-21 12:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-19  3:10 [U-Boot] [PATCH v2] FIT: delete unnecessary casts Masahiro Yamada
2013-09-19 17:22 ` Jeroen Hofstee
2013-09-21  1:59 ` Simon Glass
2013-09-21 12:07 ` [U-Boot] [U-Boot,v2] " Tom Rini

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