From: Greg Ungerer <gerg@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Heiko Stuebner <heiko@sntech.de>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] m68k: hash: Use lower_16_bits() helper
Date: Mon, 8 Jun 2026 20:53:31 +1000 [thread overview]
Message-ID: <5ef09276-0b04-4e5a-a472-c73d01ee6ac2@linux-m68k.org> (raw)
In-Reply-To: <b55e9bd0532c0cad519809c86e0a8400060d75a1.1780559561.git.geert@linux-m68k.org>
Hi Geert,
On 4/6/26 17:54, Geert Uytterhoeven wrote:
> When building for m68k with CONFIG_M68000=y and C=1:
>
> drivers/clk/rockchip/clk-rk3528.c: note: in included file (through include/linux/hash.h, include/linux/slab.h):
> arch/m68k/include/asm/hash.h:57:24: warning: cast truncates bits from constant value (18720 becomes 8720)
> arch/m68k/include/asm/hash.h:57:24: warning: cast truncates bits from constant value (1e8e8 becomes e8e8)
>
> Sparse does not realize the truncation is intentional.
> Make this explicit by using the lower_16_bits() helper instead, which
> also masks the unwanted bits.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605191434.PQkj2Rki-lkp@intel.com/
> Reported-by: Heiko Stuebner <heiko@sntech.de>
> Closes: https://lore.kernel.org/20260603213726.1025094-1-heiko@sntech.de/
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
FWIW:
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Regards
Greg
> ---
> No change in generated code.
>
> arch/m68k/include/asm/hash.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/m68k/include/asm/hash.h b/arch/m68k/include/asm/hash.h
> index 6d0d0c893f16dd49..6dadf493706632f5 100644
> --- a/arch/m68k/include/asm/hash.h
> +++ b/arch/m68k/include/asm/hash.h
> @@ -2,6 +2,8 @@
> #ifndef _ASM_HASH_H
> #define _ASM_HASH_H
>
> +#include <linux/wordpart.h>
> +
> /*
> * If CONFIG_M68000=y (original mc68000/010), this file is #included
> * to work around the lack of a MULU.L instruction.
> @@ -54,7 +56,7 @@ static inline u32 __attribute_const__ __hash_32(u32 x)
> : "=&d,d" (a), "=&r,r" (b)
> : "r,roi?" (x)); /* a+b = x*0x8647 */
>
> - return ((u16)(x*0x61c8) << 16) + a + b;
> + return (lower_16_bits(x * 0x61c8) << 16) + a + b;
> }
>
> #endif /* _ASM_HASH_H */
prev parent reply other threads:[~2026-06-08 10:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 7:54 Geert Uytterhoeven
2026-06-04 8:40 ` Heiko Stuebner
2026-06-04 8:57 ` Daniel Palmer
2026-06-08 9:19 ` Geert Uytterhoeven
2026-06-08 10:53 ` Greg Ungerer [this message]
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=5ef09276-0b04-4e5a-a472-c73d01ee6ac2@linux-m68k.org \
--to=gerg@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=lkp@intel.com \
/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
all inboxes | Powered by JetHome®