As described in the "ARM Compiler toolchain Developing Software for ARM Processors Version 5.0" document[1], SYS_WRITE0 and SYS_WRITEC corrupt the R0 register, unlike the other calls that return negative error codes. Therefore change the return type to void. [1]: https://developer.arm.com/documentation/dui0471/i/semihosting/sys-write0--0x04-?lang=en Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/firmware/semihosting.c | 8 ++++---- include/asm-generic/semihosting.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/firmware/semihosting.c b/drivers/firmware/semihosting.c index a037a95a1077..1dfbdf219727 100644 --- a/drivers/firmware/semihosting.c +++ b/drivers/firmware/semihosting.c @@ -91,15 +91,15 @@ int semihosting_close(int fd) } EXPORT_SYMBOL(semihosting_close); -int semihosting_writec(char c) +void semihosting_writec(char c) { - return semihosting_trap(SEMIHOSTING_SYS_WRITEC, &c); + (void)semihosting_trap(SEMIHOSTING_SYS_WRITEC, &c); } EXPORT_SYMBOL(semihosting_writec); -int semihosting_write0(const char *str) +void semihosting_write0(const char *str) { - return semihosting_trap(SEMIHOSTING_SYS_WRITE0, (void *)str); + (void)semihosting_trap(SEMIHOSTING_SYS_WRITE0, (void *)str); } EXPORT_SYMBOL(semihosting_write0); diff --git a/include/asm-generic/semihosting.h b/include/asm-generic/semihosting.h index b745f8831977..67031c331b97 100644 --- a/include/asm-generic/semihosting.h +++ b/include/asm-generic/semihosting.h @@ -7,8 +7,8 @@ int semihosting_open(const char *fname, int flags); int semihosting_close(int fd); -int semihosting_writec(char c); -int semihosting_write0(const char *str); +void semihosting_writec(char c); +void semihosting_write0(const char *str); ssize_t semihosting_write(int fd, const void *buf, size_t count); ssize_t semihosting_read(int fd, void *buf, size_t count); int semihosting_readc(void); -- 2.39.2