kernel: fix compiler warning caused by NVMEM-on-UBI
authorDaniel Golle <daniel@makrotopia.org>
Sun, 25 Feb 2024 23:56:55 +0000 (23:56 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 26 Feb 2024 01:29:22 +0000 (01:29 +0000)
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@makrotopia.org>
target/linux/generic/pending-6.1/450-07-mtd-ubi-provide-NVMEM-layer-over-UBI-volumes.patch

index 9e6fbea38cf469841302b657e88eaf2ffaf12e0e..59a1eb9374ea627ec83f605dd1328a38f3380e28 100644 (file)
@@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle <daniel@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@makrotopia.org>
@@ -78,14 +78,17 @@ Signed-off-by: Daniel Golle <daniel@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;