8ce2b46691e6613748abe8da0de5d6d97e466baa
[openwrt/staging/wigyori.git] /
1 From 04231c61dcd51db0f12061e49bb761b197109f2f Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Thu, 29 Feb 2024 03:47:24 +0000
4 Subject: [PATCH 8/8] mtd: ubi: fix NVMEM over UBI volumes on 32-bit systems
5
6 A compiler warning related to sizeof(int) != 8 when calling do_div()
7 is triggered when building on 32-bit platforms.
8 Address this by using integer types having a well-defined size.
9
10 Fixes: 3ce485803da1 ("mtd: ubi: provide NVMEM layer over UBI volumes")
11 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
12 Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
13 Tested-by: Randy Dunlap <rdunlap@infradead.org>
14 Signed-off-by: Richard Weinberger <richard@nod.at>
15 ---
16 drivers/mtd/ubi/nvmem.c | 5 ++++-
17 1 file changed, 4 insertions(+), 1 deletion(-)
18
19 --- a/drivers/mtd/ubi/nvmem.c
20 +++ b/drivers/mtd/ubi/nvmem.c
21 @@ -23,9 +23,12 @@ struct ubi_nvmem {
22 static int ubi_nvmem_reg_read(void *priv, unsigned int from,
23 void *val, size_t bytes)
24 {
25 - int err = 0, lnum = from, offs, bytes_left = bytes, to_read;
26 + size_t to_read, bytes_left = bytes;
27 struct ubi_nvmem *unv = priv;
28 struct ubi_volume_desc *desc;
29 + uint32_t offs;
30 + uint64_t lnum = from;
31 + int err = 0;
32
33 desc = ubi_open_volume(unv->ubi_num, unv->vol_id, UBI_READONLY);
34 if (IS_ERR(desc))