]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dfu: modify an argument type for an address
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Thu, 29 Oct 2020 04:47:42 +0000 (13:47 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 30 Oct 2020 13:20:27 +0000 (14:20 +0100)
The range of an addressable pointer can go beyond 'integer'.
So change the argument type to a void pointer.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
common/update.c
drivers/dfu/dfu_alt.c
include/dfu.h

index 39946776d74f00b71e2e538cb44fc10bf1f5e981..8dd6ee8b7ddb48e4c88b05c52049d2c97d4bc2a1 100644 (file)
@@ -324,7 +324,8 @@ got_update_file:
                        }
                } else if (fit_image_check_type(fit, noffset,
                                                IH_TYPE_FIRMWARE)) {
-                       ret = dfu_write_by_name(fit_image_name, update_addr,
+                       ret = dfu_write_by_name(fit_image_name,
+                                               (void *)update_addr,
                                                update_size, interface,
                                                devstring);
                        if (ret)
index 8870967f4a6b6c78283499c86f22fbf48c99c8be..53e8489b0e521d116c3784b2248c5c2f57364dab 100644 (file)
  *
  * Return:              0 - on success, error code - otherwise
  */
-int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
+int dfu_write_by_name(char *dfu_entity_name, void *addr,
                      unsigned int len, char *interface, char *devstring)
 {
        char *s, *sb;
        int alt_setting_num, ret;
        struct dfu_entity *dfu;
 
-       debug("%s: name: %s addr: 0x%x len: %d device: %s:%s\n", __func__,
+       debug("%s: name: %s addr: 0x%p len: %d device: %s:%s\n", __func__,
              dfu_entity_name, addr, len, interface, devstring);
 
        ret = dfu_init_env_entities(interface, devstring);
@@ -69,7 +69,7 @@ int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
                goto done;
        }
 
-       ret = dfu_write_from_mem_addr(dfu, (void *)(uintptr_t)addr, len);
+       ret = dfu_write_from_mem_addr(dfu, (void *)addr, len);
 
 done:
        dfu_free_entities();
index a4cd86c0a6c4c47837ee96f59cf87b84bcb52804..d3d7e07b60d8076f44d907a32c9fe745d816346a 100644 (file)
@@ -507,10 +507,10 @@ static inline int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr,
  * Return:             0 - on success, error code - otherwise
  */
 #if CONFIG_IS_ENABLED(DFU_WRITE_ALT)
-int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
+int dfu_write_by_name(char *dfu_entity_name, void *addr,
                      unsigned int len, char *interface, char *devstring);
 #else
-static inline int dfu_write_by_name(char *dfu_entity_name, unsigned int addr,
+static inline int dfu_write_by_name(char *dfu_entity_name, void *addr,
                                    unsigned int len, char *interface,
                                    char *devstring)
 {