soc/cavium: Fix overflow before widen
Fix Coverity CID1393974 Change-Id: I39caea8a248d2f1debfca307f6fb7a2fe3e431b1 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/27450 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
cff16b6f9d
commit
517c4c1563
|
@ -103,9 +103,9 @@ void gpio_set(gpio_t gpio, int value)
|
||||||
printk(BIOS_SPEW, "GPIO(%u): level: %u\n", gpio, !!value);
|
printk(BIOS_SPEW, "GPIO(%u): level: %u\n", gpio, !!value);
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
write64(®s->tx_set, 1 << gpio);
|
write64(®s->tx_set, 1ULL << gpio);
|
||||||
else
|
else
|
||||||
write64(®s->tx_clr, 1 << gpio);
|
write64(®s->tx_clr, 1ULL << gpio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set GPIO direction to OUTPUT with level */
|
/* Set GPIO direction to OUTPUT with level */
|
||||||
|
@ -153,9 +153,10 @@ int gpio_get(gpio_t gpio)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const u64 reg = read64(®s->rx_dat);
|
const u64 reg = read64(®s->rx_dat);
|
||||||
printk(BIOS_SPEW, "GPIO(%u): input: %u\n", gpio, !!(reg & (1 << gpio)));
|
printk(BIOS_SPEW, "GPIO(%u): input: %u\n", gpio,
|
||||||
|
!!(reg & (1ULL << gpio)));
|
||||||
|
|
||||||
return !!(reg & (1 << gpio));
|
return !!(reg & (1ULL << gpio));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read GPIO STRAP level sampled at cold boot */
|
/* Read GPIO STRAP level sampled at cold boot */
|
||||||
|
@ -167,9 +168,10 @@ int gpio_strap_value(gpio_t gpio)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const u64 reg = read64(®s->strap);
|
const u64 reg = read64(®s->strap);
|
||||||
printk(BIOS_SPEW, "GPIO(%u): strap: %u\n", gpio, !!(reg & (1 << gpio)));
|
printk(BIOS_SPEW, "GPIO(%u): strap: %u\n", gpio,
|
||||||
|
!!(reg & (1ULL << gpio)));
|
||||||
|
|
||||||
return !!(reg & (1 << gpio));
|
return !!(reg & (1ULL << gpio));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Parse devicetree ? */
|
/* FIXME: Parse devicetree ? */
|
||||||
|
|
Loading…
Reference in New Issue