[PATCH v7 4/4] crypto: starfive - Add hash and HMAC support

Herbert Xu herbert at gondor.apana.org.au
Sun May 14 21:24:01 PDT 2023


On Mon, May 15, 2023 at 11:27:35AM +0800, Jia Jie Ho wrote:
>
> I've added COMPILE_TEST in the Kconfig, then ran make W=1, sparse and smatch.
> However it did not produce the error message.

I guess you weren't testing on a 64-bit platform.  BIT(2) is
an unsigned long, so ~BIT(2) is 64-bit long on 64-bit platforms.

You're trying to feed it into writel which takes a 32-bit value,
hence the warning.

If you have to use the BIT macro, then you need to cast the result
to u32:

#define STARFIVE_IE_MASK_HASH_DONE ((u32)BIT(2))

But it's probably a lot clearer if you do it as:

#define STARFIVE_IE_MASK_HASH_DONE 0x4

Cheers,
-- 
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



More information about the linux-riscv mailing list