Message ID | 20230722140209.1897117-3-jonas@kwiboo.se |
---|---|
State | Accepted |
Commit | 8c1bb04b5699ce74ad727d4513e1a40a58c9c628 |
Delegated to: | Kever Yang |
Headers | show |
Series | board: rockchip: Add Hardkernel ODROID-M1 | expand |
On 2023/7/22 22:02, Jonas Karlman wrote: > Building U-Boot with CMD_INI=y result in following build warning: > > cmd/ini.c: In function 'memgets': > include/linux/kernel.h:184:24: warning: comparison of distinct pointer types lacks a cast > 184 | (void) (&_min1 == &_min2); \ > | ^~ > cmd/ini.c:92:15: note: in expansion of macro 'min' > 92 | len = min((end - *mem) + newline, num); > | ^~~ > > Fix this by adding an int cast to the pointer arithmetic result. > > Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Thanks, - Kever > --- > v3: > - No changes > > v2: > - New patch > > cmd/ini.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/cmd/ini.c b/cmd/ini.c > index 81dfc4c4e83d..35de2373e602 100644 > --- a/cmd/ini.c > +++ b/cmd/ini.c > @@ -89,7 +89,7 @@ static char *memgets(char *str, int num, char **mem, size_t *memsize) > end = *mem + *memsize; > newline = 0; > } > - len = min((end - *mem) + newline, num); > + len = min((int)(end - *mem) + newline, num); > memcpy(str, *mem, len); > if (len < num) > str[len] = '\0';
diff --git a/cmd/ini.c b/cmd/ini.c index 81dfc4c4e83d..35de2373e602 100644 --- a/cmd/ini.c +++ b/cmd/ini.c @@ -89,7 +89,7 @@ static char *memgets(char *str, int num, char **mem, size_t *memsize) end = *mem + *memsize; newline = 0; } - len = min((end - *mem) + newline, num); + len = min((int)(end - *mem) + newline, num); memcpy(str, *mem, len); if (len < num) str[len] = '\0';
Building U-Boot with CMD_INI=y result in following build warning: cmd/ini.c: In function 'memgets': include/linux/kernel.h:184:24: warning: comparison of distinct pointer types lacks a cast 184 | (void) (&_min1 == &_min2); \ | ^~ cmd/ini.c:92:15: note: in expansion of macro 'min' 92 | len = min((end - *mem) + newline, num); | ^~~ Fix this by adding an int cast to the pointer arithmetic result. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> --- v3: - No changes v2: - New patch cmd/ini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)