[PATCH 1/3] dfu: use pointer to pass length to dfu_write()

Tom Rini trini at konsulko.com
Fri Jan 28 16:21:36 CET 2022


On Thu, Sep 30, 2021 at 06:22:06PM +0200, Frieder Schrempf wrote:

> From: Frieder Schrempf <frieder.schrempf at kontron.de>
> 
> This doesn't include any functional changes, but allows us to use the
> size parameter to report the actual written bytes back to the caller.
> 
> This is useful in cases of unaligned writes to serial flash where the
> first write covers only a part of the buffer (until the next sector
> boundary) and the remaining bytes need to be written in a further call
> to dfu_write().
> 
> While at it, we also adjust the data type of the 'write' and 'left'
> variable in dfu_write_from_mem_addr() to match the values passed.
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf at kontron.de>

This causes:

   aarch64:  +   qemu_arm64
+(qemu_arm64) In file included from include/linux/bitops.h:22,
+(qemu_arm64)                  from include/log.h:15,
+(qemu_arm64)                  from include/linux/printk.h:4,
+(qemu_arm64)                  from include/common.h:20,
+(qemu_arm64)                  from drivers/dfu/dfu.c:9:
+(qemu_arm64) drivers/dfu/dfu.c: In function 'dfu_write_from_mem_addr':
+(qemu_arm64) include/linux/kernel.h:184:24: error: comparison of distinct pointer types lacks a cast [-Werror]
+(qemu_arm64)   184 |         (void) (&_min1 == &_min2);              \
+(qemu_arm64)       |                        ^~
+(qemu_arm64) drivers/dfu/dfu.c:748:25: note: in expansion of macro 'min'
+(qemu_arm64)   748 |                 write = min(dfu_buf_size, left);
+(qemu_arm64)       |                         ^~~
+(qemu_arm64) In file included from include/linux/printk.h:4,
+(qemu_arm64) drivers/dfu/dfu.c:750:23: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Werror=format=]
+(qemu_arm64)   750 |                 debug("%s: dp: 0x%p left: %lu write: %u\n", __func__,
+(qemu_arm64)       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+(qemu_arm64) include/log.h:163:21: note: in definition of macro 'pr_fmt'
+(qemu_arm64)   163 | #define pr_fmt(fmt) fmt
+(qemu_arm64)       |                     ^~~
+(qemu_arm64) include/log.h:283:9: note: in expansion of macro 'debug_cond'
+(qemu_arm64)   283 |         debug_cond(_DEBUG, fmt, ##args)
+(qemu_arm64)       |         ^~~~~~~~~~
+(qemu_arm64) drivers/dfu/dfu.c:750:17: note: in expansion of macro 'debug'
+(qemu_arm64)       |                 ^~~~~
+(qemu_arm64) drivers/dfu/dfu.c:750:45: note: format string is defined here
+(qemu_arm64)       |                                           ~~^
+(qemu_arm64)       |                                             |
+(qemu_arm64)       |                                             long unsigned int
+(qemu_arm64)       |                                           %u
+(qemu_arm64) cc1: all warnings being treated as errors
+(qemu_arm64) make[3]: *** [scripts/Makefile.build:253: drivers/dfu/dfu.o] Error 1
+(qemu_arm64) make[2]: *** [scripts/Makefile.build:394: drivers/dfu] Error 2
+(qemu_arm64) make[1]: *** [Makefile:1889: drivers] Error 2
+(qemu_arm64) make: *** [Makefile:177: sub-make] Error 2

Please rework and repost, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220128/12c19350/attachment.sig>


More information about the U-Boot mailing list