From: Daniel Golle Date: Sun, 25 Feb 2024 23:56:55 +0000 (+0000) Subject: kernel: fix compiler warning caused by NVMEM-on-UBI X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0acf0bc2043e56dc90df3b61192cd312b6cf8fdd;p=openwrt%2Fstaging%2Fjow.git kernel: fix compiler warning caused by NVMEM-on-UBI When building the UBI NVMEM provider on 32-bit platforms a compiler warning is triggered due to different sizeof(int). Fix this by using integer types with well-defined size. Signed-off-by: Daniel Golle --- diff --git a/target/linux/generic/pending-6.1/450-07-mtd-ubi-provide-NVMEM-layer-over-UBI-volumes.patch b/target/linux/generic/pending-6.1/450-07-mtd-ubi-provide-NVMEM-layer-over-UBI-volumes.patch index 9e6fbea38c..59a1eb9374 100644 --- a/target/linux/generic/pending-6.1/450-07-mtd-ubi-provide-NVMEM-layer-over-UBI-volumes.patch +++ b/target/linux/generic/pending-6.1/450-07-mtd-ubi-provide-NVMEM-layer-over-UBI-volumes.patch @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle +obj-$(CONFIG_MTD_UBI_NVMEM) += nvmem.o --- /dev/null +++ b/drivers/mtd/ubi/nvmem.c -@@ -0,0 +1,188 @@ +@@ -0,0 +1,191 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2023 Daniel Golle @@ -78,14 +78,17 @@ Signed-off-by: Daniel Golle +static int ubi_nvmem_reg_read(void *priv, unsigned int from, + void *val, size_t bytes) +{ -+ int err = 0, lnum = from, offs, bytes_left = bytes, to_read; ++ uint32_t offs, to_read, bytes_left; + struct ubi_nvmem *unv = priv; + struct ubi_volume_desc *desc; ++ uint64_t lnum = from; ++ int err = 0; + + desc = ubi_open_volume(unv->ubi_num, unv->vol_id, UBI_READONLY); + if (IS_ERR(desc)) + return PTR_ERR(desc); + ++ bytes_left = bytes; + offs = do_div(lnum, unv->usable_leb_size); + while (bytes_left) { + to_read = unv->usable_leb_size - offs;