|
|
c96cf6 |
From a76ac50c3049b7fa77f71828c4e0a3569eea626d Mon Sep 17 00:00:00 2001
|
|
|
c96cf6 |
From: Michal Kubecek <mkubecek@suse.cz>
|
|
|
c96cf6 |
Date: Sun, 23 Aug 2020 21:40:33 +0200
|
|
|
c96cf6 |
Subject: [PATCH 08/17] get rid of signed/unsigned comparison warnings in
|
|
|
c96cf6 |
register dump parsers
|
|
|
c96cf6 |
|
|
|
c96cf6 |
All of these are avoided by declaring a variable (mostly loop iterators)
|
|
|
c96cf6 |
holding only unsigned values as unsigned.
|
|
|
c96cf6 |
|
|
|
c96cf6 |
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
|
|
|
c96cf6 |
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
|
|
c96cf6 |
(cherry picked from commit 16c87d0a03757958d857d7054bd296bfc74c6d39)
|
|
|
c96cf6 |
---
|
|
|
c96cf6 |
dsa.c | 2 +-
|
|
|
c96cf6 |
fec.c | 2 +-
|
|
|
c96cf6 |
ibm_emac.c | 2 +-
|
|
|
c96cf6 |
marvell.c | 2 +-
|
|
|
c96cf6 |
natsemi.c | 2 +-
|
|
|
c96cf6 |
rxclass.c | 8 +++++---
|
|
|
c96cf6 |
sfpdiag.c | 2 +-
|
|
|
c96cf6 |
tg3.c | 4 ++--
|
|
|
c96cf6 |
8 files changed, 13 insertions(+), 11 deletions(-)
|
|
|
c96cf6 |
|
|
|
c96cf6 |
diff --git a/dsa.c b/dsa.c
|
|
|
c96cf6 |
index 65502a899194..33c1d39d6605 100644
|
|
|
c96cf6 |
--- a/dsa.c
|
|
|
c96cf6 |
+++ b/dsa.c
|
|
|
c96cf6 |
@@ -824,8 +824,8 @@ static int dsa_mv88e6xxx_dump_regs(struct ethtool_regs *regs)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
const struct dsa_mv88e6xxx_switch *sw = NULL;
|
|
|
c96cf6 |
const u16 *data = (u16 *)regs->data;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
u16 id;
|
|
|
c96cf6 |
- int i;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
/* Marvell chips have 32 per-port 16-bit registers */
|
|
|
c96cf6 |
if (regs->len < 32 * sizeof(u16))
|
|
|
c96cf6 |
diff --git a/fec.c b/fec.c
|
|
|
c96cf6 |
index 9cb4f8b1d4e1..d2373d6124c0 100644
|
|
|
c96cf6 |
--- a/fec.c
|
|
|
c96cf6 |
+++ b/fec.c
|
|
|
c96cf6 |
@@ -198,7 +198,7 @@ int fec_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
|
|
|
c96cf6 |
struct ethtool_regs *regs)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
const u32 *data = (u32 *)regs->data;
|
|
|
c96cf6 |
- int offset;
|
|
|
c96cf6 |
+ unsigned int offset;
|
|
|
c96cf6 |
u32 val;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
for (offset = 0; offset < regs->len; offset += 4) {
|
|
|
c96cf6 |
diff --git a/ibm_emac.c b/ibm_emac.c
|
|
|
c96cf6 |
index ea01d56f609c..9f7cae605482 100644
|
|
|
c96cf6 |
--- a/ibm_emac.c
|
|
|
c96cf6 |
+++ b/ibm_emac.c
|
|
|
c96cf6 |
@@ -238,7 +238,7 @@ static void *print_mal_regs(void *buf)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
struct emac_ethtool_regs_subhdr *hdr = buf;
|
|
|
c96cf6 |
struct mal_regs *p = (struct mal_regs *)(hdr + 1);
|
|
|
c96cf6 |
- int i;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
printf("MAL%d Registers\n", hdr->index);
|
|
|
c96cf6 |
printf("-----------------\n");
|
|
|
c96cf6 |
diff --git a/marvell.c b/marvell.c
|
|
|
c96cf6 |
index 8afb150327a3..d3d570e4d4ad 100644
|
|
|
c96cf6 |
--- a/marvell.c
|
|
|
c96cf6 |
+++ b/marvell.c
|
|
|
c96cf6 |
@@ -130,7 +130,7 @@ static void dump_fifo(const char *name, const void *p)
|
|
|
c96cf6 |
static void dump_gmac_fifo(const char *name, const void *p)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
const u32 *r = p;
|
|
|
c96cf6 |
- int i;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
static const char *regs[] = {
|
|
|
c96cf6 |
"End Address",
|
|
|
c96cf6 |
"Almost Full Thresh",
|
|
|
c96cf6 |
diff --git a/natsemi.c b/natsemi.c
|
|
|
c96cf6 |
index 0af465959cbc..4d9fc092b623 100644
|
|
|
c96cf6 |
--- a/natsemi.c
|
|
|
c96cf6 |
+++ b/natsemi.c
|
|
|
c96cf6 |
@@ -967,8 +967,8 @@ int
|
|
|
c96cf6 |
natsemi_dump_eeprom(struct ethtool_drvinfo *info __maybe_unused,
|
|
|
c96cf6 |
struct ethtool_eeprom *ee)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
- int i;
|
|
|
c96cf6 |
u16 *eebuf = (u16 *)ee->data;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
if (ee->magic != NATSEMI_MAGIC) {
|
|
|
c96cf6 |
fprintf(stderr, "Magic number 0x%08x does not match 0x%08x\n",
|
|
|
c96cf6 |
diff --git a/rxclass.c b/rxclass.c
|
|
|
c96cf6 |
index 79972651e706..6cf81fdafc85 100644
|
|
|
c96cf6 |
--- a/rxclass.c
|
|
|
c96cf6 |
+++ b/rxclass.c
|
|
|
c96cf6 |
@@ -348,8 +348,9 @@ int rxclass_rule_getall(struct cmd_context *ctx)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
struct ethtool_rxnfc *nfccmd;
|
|
|
c96cf6 |
__u32 *rule_locs;
|
|
|
c96cf6 |
- int err, i;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
__u32 count;
|
|
|
c96cf6 |
+ int err;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
/* determine rule count */
|
|
|
c96cf6 |
err = rxclass_get_dev_info(ctx, &count, NULL);
|
|
|
c96cf6 |
@@ -481,8 +482,9 @@ static int rmgr_find_empty_slot(struct rmgr_ctrl *rmgr,
|
|
|
c96cf6 |
static int rmgr_init(struct cmd_context *ctx, struct rmgr_ctrl *rmgr)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
struct ethtool_rxnfc *nfccmd;
|
|
|
c96cf6 |
- int err, i;
|
|
|
c96cf6 |
__u32 *rule_locs;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
+ int err;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
/* clear rule manager settings */
|
|
|
c96cf6 |
memset(rmgr, 0, sizeof(*rmgr));
|
|
|
c96cf6 |
@@ -941,7 +943,7 @@ static int rxclass_get_long(char *str, long long *val, int size)
|
|
|
c96cf6 |
|
|
|
c96cf6 |
static int rxclass_get_ulong(char *str, unsigned long long *val, int size)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
- long long max = ~0ULL >> (64 - size);
|
|
|
c96cf6 |
+ unsigned long long max = ~0ULL >> (64 - size);
|
|
|
c96cf6 |
char *endp;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
errno = 0;
|
|
|
c96cf6 |
diff --git a/sfpdiag.c b/sfpdiag.c
|
|
|
c96cf6 |
index fa41651422ea..1fa8b7ba8fec 100644
|
|
|
c96cf6 |
--- a/sfpdiag.c
|
|
|
c96cf6 |
+++ b/sfpdiag.c
|
|
|
c96cf6 |
@@ -190,8 +190,8 @@ static float befloattoh(const __u32 *source)
|
|
|
c96cf6 |
|
|
|
c96cf6 |
static void sff8472_calibration(const __u8 *id, struct sff_diags *sd)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
- int i;
|
|
|
c96cf6 |
__u16 rx_reading;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
/* Calibration should occur for all values (threshold and current) */
|
|
|
c96cf6 |
for (i = 0; i < ARRAY_SIZE(sd->bias_cur); ++i) {
|
|
|
c96cf6 |
diff --git a/tg3.c b/tg3.c
|
|
|
c96cf6 |
index ac73b33ae4e3..ebdef2d60e6b 100644
|
|
|
c96cf6 |
--- a/tg3.c
|
|
|
c96cf6 |
+++ b/tg3.c
|
|
|
c96cf6 |
@@ -7,7 +7,7 @@
|
|
|
c96cf6 |
int tg3_dump_eeprom(struct ethtool_drvinfo *info __maybe_unused,
|
|
|
c96cf6 |
struct ethtool_eeprom *ee)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
- int i;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
if (ee->magic != TG3_MAGIC) {
|
|
|
c96cf6 |
fprintf(stderr, "Magic number 0x%08x does not match 0x%08x\n",
|
|
|
c96cf6 |
@@ -26,7 +26,7 @@ int tg3_dump_eeprom(struct ethtool_drvinfo *info __maybe_unused,
|
|
|
c96cf6 |
int tg3_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
|
|
|
c96cf6 |
struct ethtool_regs *regs)
|
|
|
c96cf6 |
{
|
|
|
c96cf6 |
- int i;
|
|
|
c96cf6 |
+ unsigned int i;
|
|
|
c96cf6 |
u32 reg;
|
|
|
c96cf6 |
|
|
|
c96cf6 |
fprintf(stdout, "Offset\tValue\n");
|
|
|
c96cf6 |
--
|
|
|
c96cf6 |
2.26.2
|
|
|
c96cf6 |
|