]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nvmem: layouts: Switch from crc32() to crc32_le()
authorEric Biggers <ebiggers@kernel.org>
Fri, 20 Jun 2025 20:50:27 +0000 (13:50 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 30 Jun 2025 16:31:57 +0000 (09:31 -0700)
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>
drivers/nvmem/layouts/u-boot-env.c

index 436426d4e8f910b51b92f88acddfbb40d374587a..274e8a456e8c16b3545ee5fad384b65ba2d5215d 100644 (file)
@@ -148,7 +148,7 @@ int u_boot_env_parse(struct device *dev, struct nvmem_device *nvmem,
        crc32_data_len = dev_size - crc32_data_offset;
        data_len = dev_size - data_offset;
 
-       calc = crc32(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L;
+       calc = crc32_le(~0, buf + crc32_data_offset, crc32_data_len) ^ ~0L;
        if (calc != crc32) {
                dev_err(dev, "Invalid calculated CRC32: 0x%08x (expected: 0x%08x)\n", calc, crc32);
                err = -EINVAL;