[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <79e1dec195d287001515600b1dae0bcaa33fbf65.1583522277.git.hns@goldelico.com>
Date: Fri, 6 Mar 2020 20:17:58 +0100
From: "H. Nikolaus Schaller" <hns@...delico.com>
To: PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>
Cc: linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
letux-kernel@...nphoenux.org,
"H. Nikolaus Schaller" <hns@...delico.com>,
kbuild test robot <lkp@...el.com>,
Stephen Rothwell <sfr@...b.auug.org.au>, malat@...ian.org,
paul@...pouillou.net
Subject: [PATCH] nvmem: jz4780-efuse: fix build warnings on ARCH=x86_64 or riscv
kbuild-robot did find a type error in the min(a, b)
function used by this driver if built for x86_64 or riscv.
Althought it is very unlikely that this driver is built
for those platforms it could be used as a template
for something else and therefore should be correct.
The problem is that we implicitly cast a size_t to
unsigned int inside the implementation of the min() function.
Since size_t may differ on different compilers and
plaforms there may be warnings or not.
So let's use only size_t variables on all platforms.
Reported-by: kbuild test robot <lkp@...el.com>
Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
Cc: srinivas.kandagatla@...aro.org
Cc: prasannatsmkumar@...il.com
Cc: malat@...ian.org
Cc: paul@...pouillou.net
Signed-off-by: H. Nikolaus Schaller <hns@...delico.com>
---
drivers/nvmem/jz4780-efuse.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvmem/jz4780-efuse.c b/drivers/nvmem/jz4780-efuse.c
index 51d140980b1e..512e1872ba36 100644
--- a/drivers/nvmem/jz4780-efuse.c
+++ b/drivers/nvmem/jz4780-efuse.c
@@ -72,9 +72,9 @@ static int jz4780_efuse_read(void *context, unsigned int offset,
struct jz4780_efuse *efuse = context;
while (bytes > 0) {
- unsigned int start = offset & ~(JZ_EFU_READ_SIZE - 1);
- unsigned int chunk = min(bytes, (start + JZ_EFU_READ_SIZE)
- - offset);
+ size_t start = offset & ~(JZ_EFU_READ_SIZE - 1);
+ size_t chunk = min(bytes, (start + JZ_EFU_READ_SIZE)
+ - offset);
char buf[JZ_EFU_READ_SIZE];
unsigned int tmp;
u32 ctrl;
--
2.23.0
Powered by blists - more mailing lists