U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Karlman <jonas@kwiboo.se>
To: Kever Yang <kever.yang@rock-chips.com>,
	Simon Glass <sjg@chromium.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Stefan Agner <stefan@agner.ch>,
	u-boot@lists.denx.de, Jonas Karlman <jonas@kwiboo.se>
Subject: [PATCH v3 2/3] cmd: ini: Fix build warning
Date: Sat, 22 Jul 2023 14:02:13 +0000 (UTC)	[thread overview]
Message-ID: <20230722140209.1897117-3-jonas@kwiboo.se> (raw)
In-Reply-To: <20230722140209.1897117-1-jonas@kwiboo.se>

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

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


  parent reply	other threads:[~2023-07-22 14:02 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 ` Jonas Karlman [this message]
2023-07-28  9:47   ` [PATCH v3 2/3] cmd: ini: Fix build warning Kever Yang
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=20230722140209.1897117-3-jonas@kwiboo.se \
    --to=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --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