aboutsummaryrefslogtreecommitdiffstats
path: root/ichspi.c
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2018-12-23 20:03:35 +0100
committerNico Huber <nico.h@gmx.de>2019-07-31 08:26:59 +0000
commit519be66fc59558971dd653afe69ccaf1a633b492 (patch)
tree74f0912de156a86d56111f377db080246e5205e9 /ichspi.c
parentef78de4a21323b8c459337356289218211f2c5ce (diff)
downloadflashrom-519be66fc59558971dd653afe69ccaf1a633b492.tar.gz
flashrom-519be66fc59558971dd653afe69ccaf1a633b492.tar.bz2
flashrom-519be66fc59558971dd653afe69ccaf1a633b492.zip
Fix -Wsign-compare trouble
Mostly by changing to `unsigned` types where applicable, sometimes `signed` types, and casting as a last resort. Change-Id: I08895543ffb7a48058bcf91ef6500ca113f2d305 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/30409 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jacob Garber <jgarber1@ualberta.ca>
Diffstat (limited to 'ichspi.c')
-rw-r--r--ichspi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ichspi.c b/ichspi.c
index e1ede60d..8b8f0f6e 100644
--- a/ichspi.c
+++ b/ichspi.c
@@ -470,7 +470,7 @@ static struct {
static uint8_t lookup_spi_type(uint8_t opcode)
{
- int a;
+ unsigned int a;
for (a = 0; a < ARRAY_SIZE(POSSIBLE_OPCODES); a++) {
if (POSSIBLE_OPCODES[a].opcode == opcode)
@@ -1564,7 +1564,7 @@ static const char *const access_names[] = {
"locked", "read-only", "write-only", "read-write"
};
-static enum ich_access_protection ich9_handle_frap(uint32_t frap, int i)
+static enum ich_access_protection ich9_handle_frap(uint32_t frap, unsigned int i)
{
const int rwperms_unknown = ARRAY_SIZE(access_names);
static const char *const region_names[6] = {
@@ -1595,23 +1595,23 @@ static enum ich_access_protection ich9_handle_frap(uint32_t frap, int i)
limit = ICH_FREG_LIMIT(freg);
if (base > limit || (freg == 0 && i > 0)) {
/* this FREG is disabled */
- msg_pdbg2("0x%02X: 0x%08x FREG%i: %s region is unused.\n",
+ msg_pdbg2("0x%02X: 0x%08x FREG%u: %s region is unused.\n",
offset, freg, i, region_name);
return NO_PROT;
}
msg_pdbg("0x%02X: 0x%08x ", offset, freg);
if (rwperms == 0x3) {
- msg_pdbg("FREG%i: %s region (0x%08x-0x%08x) is %s.\n", i,
+ msg_pdbg("FREG%u: %s region (0x%08x-0x%08x) is %s.\n", i,
region_name, base, limit, access_names[rwperms]);
return NO_PROT;
}
if (rwperms == rwperms_unknown) {
- msg_pdbg("FREG%i: %s region (0x%08x-0x%08x) has unknown permissions.\n",
+ msg_pdbg("FREG%u: %s region (0x%08x-0x%08x) has unknown permissions.\n",
i, region_name, base, limit);
return NO_PROT;
}
- msg_pinfo("FREG%i: %s region (0x%08x-0x%08x) is %s.\n", i,
+ msg_pinfo("FREG%u: %s region (0x%08x-0x%08x) is %s.\n", i,
region_name, base, limit, access_names[rwperms]);
return access_perms_to_protection[rwperms];
}
@@ -1625,7 +1625,7 @@ static enum ich_access_protection ich9_handle_frap(uint32_t frap, int i)
#define ICH_PR_PERMS(pr) (((~((pr) >> PR_RP_OFF) & 1) << 0) | \
((~((pr) >> PR_WP_OFF) & 1) << 1))
-static enum ich_access_protection ich9_handle_pr(const size_t reg_pr0, int i)
+static enum ich_access_protection ich9_handle_pr(const size_t reg_pr0, unsigned int i)
{
uint8_t off = reg_pr0 + (i * 4);
uint32_t pr = mmio_readl(ich_spibar + off);
@@ -1701,7 +1701,7 @@ static const struct opaque_master opaque_master_ich_hwseq = {
int ich_init_spi(void *spibar, enum ich_chipset ich_gen)
{
- int i;
+ unsigned int i;
uint16_t tmp2;
uint32_t tmp;
char *arg;
@@ -1786,7 +1786,7 @@ int ich_init_spi(void *spibar, enum ich_chipset ich_gen)
for (i = 0; i < 3; i++) {
int offs;
offs = 0x60 + (i * 4);
- msg_pdbg("0x%02x: 0x%08x (PBR%d)\n", offs,
+ msg_pdbg("0x%02x: 0x%08x (PBR%u)\n", offs,
mmio_readl(ich_spibar + offs), i);
}
if (mmio_readw(ich_spibar) & (1 << 15)) {