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@makrotopia.org>
This commit is contained in:
Daniel Golle 2024-02-25 23:56:55 +00:00
parent c2537f3c8f
commit 0acf0bc204
1 changed files with 5 additions and 2 deletions

View 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;