U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kever Yang <kever.yang@rock-chips.com>
To: Jonas Karlman <jonas@kwiboo.se>, Simon Glass <sjg@chromium.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Stefan Agner <stefan@agner.ch>, u-boot@lists.denx.de
Subject: Re: [PATCH v3 2/3] cmd: ini: Fix build warning
Date: Fri, 28 Jul 2023 17:47:18 +0800	[thread overview]
Message-ID: <c0b5a222-698a-92b2-e7c5-79bf0bc8abc0@rock-chips.com> (raw)
In-Reply-To: <20230722140209.1897117-3-jonas@kwiboo.se>


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

  reply	other threads:[~2023-07-28  9:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22 14:02 [PATCH v3 0/3] board: rockchip: Add Hardkernel ODROID-M1 Jonas Karlman
2023-07-22 14:02 ` [PATCH v3 1/3] ata: dwc_ahci: Fix support for other platforms Jonas Karlman
2023-07-22 14:02 ` [PATCH v3 2/3] cmd: ini: Fix build warning Jonas Karlman
2023-07-28  9:47   ` Kever Yang [this message]
2023-07-22 14:02 ` [PATCH v3 3/3] board: rockchip: Add Hardkernel ODROID-M1 Jonas Karlman
2023-07-26  1:44   ` Kever Yang
2023-07-26  1:47 ` [PATCH v3 0/3] " Kever Yang
2023-07-26  6:34   ` Jonas Karlman
2023-07-26 13:37     ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0b5a222-698a-92b2-e7c5-79bf0bc8abc0@rock-chips.com \
    --to=kever.yang@rock-chips.com \
    --cc=jonas@kwiboo.se \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --cc=stefan@agner.ch \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox