[openwrt/openwrt] kernel: fix compiler warning caused by NVMEM-on-UBI
LEDE Commits
lede-commits at lists.infradead.org
Sun Feb 25 18:16:17 PST 2024
dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/0acf0bc2043e56dc90df3b61192cd312b6cf8fdd
commit 0acf0bc2043e56dc90df3b61192cd312b6cf8fdd
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Sun Feb 25 23:56:55 2024 +0000
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 <daniel at makrotopia.org>
---
.../450-07-mtd-ubi-provide-NVMEM-layer-over-UBI-volumes.patch | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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 <daniel at makrotopia.org>
+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 <daniel at makrotopia.org>
@@ -78,14 +78,17 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+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;
More information about the lede-commits
mailing list