diff mbox series

[v7,02/17] dfu: modify an argument type for an address

Message ID 20201029044757.183262-3-takahiro.akashi@linaro.org
State Superseded
Headers show
Series efi_loader: add capsule update support | expand

Commit Message

AKASHI Takahiro Oct. 29, 2020, 4:47 a.m. UTC
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>

---
 common/update.c       | 3 ++-
 drivers/dfu/dfu_alt.c | 6 +++---
 include/dfu.h         | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

-- 
2.28.0

Comments

Tom Rini Oct. 29, 2020, 2:43 p.m. UTC | #1
On Thu, Oct 29, 2020 at 01:47:42PM +0900, AKASHI Takahiro wrote:

> 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>


-- 
Tom
diff mbox series

Patch

diff --git a/common/update.c b/common/update.c
index 39946776d74f..8dd6ee8b7ddb 100644
--- a/common/update.c
+++ b/common/update.c
@@ -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)
diff --git a/drivers/dfu/dfu_alt.c b/drivers/dfu/dfu_alt.c
index 5b1b13d7170d..7528806cd163 100644
--- a/drivers/dfu/dfu_alt.c
+++ b/drivers/dfu/dfu_alt.c
@@ -23,14 +23,14 @@ 
  *
  * 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();
diff --git a/include/dfu.h b/include/dfu.h
index a4cd86c0a6c4..d3d7e07b60d8 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -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)
 {