Skip to content

Commit

Permalink
nvmem: jz4780-efuse: fix build warnings on ARCH=x86_64 or riscv
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Stephen Rothwell <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: H. Nikolaus Schaller <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
goldelico authored and gregkh committed Mar 19, 2020
1 parent 49d37c6 commit ba2bb5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/nvmem/jz4780-efuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ba2bb5f

Please sign in to comment.