Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvmem: layouts: Switch from crc32() to crc32_le()

u_boot_env_parse() calls crc32() from within a scope that has a uint32_t
variable named crc32. This works only because crc32() is actually a
macro that expands to crc32_le(). I'm planning to make it an inline
function instead, which will make the usual C scoping rules apply to it.
Therefore, update u_boot_env_parse() to be compatible with that. To do
so, just call crc32_le() directly instead of using the crc32() alias.
(An alternative would be to rename the local variable.)

Acked-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://lore.kernel.org/r/20250620205027.23403-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+1 -1
+1 -1
drivers/nvmem/layouts/u-boot-env.c
··· 148 148 crc32_data_len = dev_size - crc32_data_offset; 149 149 data_len = dev_size - data_offset; 150 150 151 - calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; 151 + calc = crc32_le(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L; 152 152 if (calc != crc32) { 153 153 dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", calc, crc32); 154 154 err = -EINVAL;