Commit 2f492672 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman
Browse files

tty: gdm724x: use min_t() for size_t varable and a constant



My thinking was that ulong is the same as size_t everywhere. No, size_t
is uint on 32bit. So the below commit introduced a build warning on
32bit:
.../gdm724x/gdm_tty.c:165:24: warning: comparison of distinct pointer types ('typeof (2048UL) *' (aka 'unsigned long *') and 'typeof (remain) *' (aka 'unsigned int *'))

To fix this, partially revert the commit (remove constants' suffixes)
and switch to min_t() in this case instead.

/me would hope for Z (or alike) suffix for constants.

Signed-off-by: default avatar"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Fixes: c3e5c706 (tty: gdm724x: convert counts to size_t)
Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308151953.rNNnAR2N-lkp@intel.com/


Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
Link: https://lore.kernel.org/r/20230816085322.22065-1-jirislaby@kernel.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 642073c3
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -17,9 +17,9 @@
#define GDM_TTY_MAJOR 0
#define GDM_TTY_MAJOR 0
#define GDM_TTY_MINOR 32
#define GDM_TTY_MINOR 32


#define WRITE_SIZE 2048UL
#define WRITE_SIZE 2048


#define MUX_TX_MAX_SIZE 2048UL
#define MUX_TX_MAX_SIZE 2048


static inline bool gdm_tty_ready(struct gdm *gdm)
static inline bool gdm_tty_ready(struct gdm *gdm)
{
{
@@ -159,7 +159,7 @@ static ssize_t gdm_tty_write(struct tty_struct *tty, const u8 *buf, size_t len)
		return -ENODEV;
		return -ENODEV;


	while (remain) {
	while (remain) {
		size_t sending_len = min(MUX_TX_MAX_SIZE, remain);
		size_t sending_len = min_t(size_t, MUX_TX_MAX_SIZE, remain);
		gdm->tty_dev->send_func(gdm->tty_dev->priv_dev,
		gdm->tty_dev->send_func(gdm->tty_dev->priv_dev,
					(void *)(buf + sent_len),
					(void *)(buf + sent_len),
					sending_len,
					sending_len,