mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-10-06 10:59:48 +08:00
bsps/shared: Address -Wsign-compare warnings
This warning occurs when comparing a signed variable to an unsigned one. This addresses warnings that only occurred on 64-bit targets. For the ones which only appeared on 64-bit targets, the cause was frequently a mismatch when comparing a combination off_t, ssize_t, and int.
This commit is contained in:
committed by
Gedare Bloom
parent
529eff1b7b
commit
d78565bcdb
@@ -141,7 +141,7 @@ static int xnandpsu_erase_wrapper(
|
||||
}
|
||||
|
||||
/* Perform erase operation. */
|
||||
for ( int i = 0; i < erase_count; i++ ) {
|
||||
for ( uint64_t i = 0; i < erase_count; i++ ) {
|
||||
uint8_t sector_bad = 0;
|
||||
uint64_t block_start = start_offset + i * block_size;
|
||||
rv = xnandpsu_sector_health( flash, block_start, §or_bad );
|
||||
@@ -246,7 +246,7 @@ static int xnandpsu_sector_info_by_offset(
|
||||
*sector_off = RTEMS_ALIGN_DOWN( search_off, nandpsu->Geometry.BlockSize );
|
||||
*sector_size = nandpsu->Geometry.BlockSize;
|
||||
|
||||
if ( *sector_off > nandpsu->Geometry.DeviceSize ) {
|
||||
if ( (uint64_t)*sector_off > nandpsu->Geometry.DeviceSize ) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ static int xnandpsu_sector_health(
|
||||
|
||||
sector_off = RTEMS_ALIGN_DOWN( search_offset, nandpsu->Geometry.BlockSize );
|
||||
|
||||
if ( sector_off > nandpsu->Geometry.DeviceSize ) {
|
||||
if ( (uint64_t)sector_off > nandpsu->Geometry.DeviceSize ) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ static int xnandpsu_sector_mark_bad( rtems_flashdev *flash, off_t offset )
|
||||
rtems_status_code sc;
|
||||
uint32_t BlockIndex;
|
||||
|
||||
if ( offset > nandpsu->Geometry.DeviceSize ) {
|
||||
if ( (uint64_t)offset > nandpsu->Geometry.DeviceSize ) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
||||
@@ -1281,7 +1281,7 @@ int rtems_gpio_get_value(uint32_t pin_number)
|
||||
|
||||
rv = rtems_gpio_bsp_get_value(bank, pin);
|
||||
|
||||
if ( rv == GPIO_INPUT_ERROR ) {
|
||||
if ( rv == (uint32_t) GPIO_INPUT_ERROR ) {
|
||||
RELEASE_LOCK(gpio_bank_state[bank].lock);
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -1638,7 +1638,7 @@ s32 XNandPsu_Read(XNandPsu *InstancePtr, u64 Offset, u64 Length, u8 *DestBuf)
|
||||
(u32)LengthVar;
|
||||
}
|
||||
#ifdef __rtems__
|
||||
if (Page == InstancePtr->PartialDataPageIndex) {
|
||||
if (Page == (uint32_t)InstancePtr->PartialDataPageIndex) {
|
||||
/*
|
||||
* This is a whole page read for the currently cached
|
||||
* page. It will not be taken care of below, so perform
|
||||
|
||||
@@ -32,7 +32,7 @@ unsigned char pci_bus_count(void)
|
||||
for (device=0; device < PCI_MAX_DEVICES; device++) {
|
||||
|
||||
pci_read_config_dword(bus, device, 0, PCI_VENDOR_ID, &vendor);
|
||||
if ( vendor == -1 ) {
|
||||
if ( vendor == (uint32_t)-1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ unsigned char pci_bus_count(void)
|
||||
|
||||
for ( function=0; function < number_of_functions; function++ ) {
|
||||
pci_read_config_dword(bus, device, function, PCI_VENDOR_ID, &vendor);
|
||||
if ( vendor == -1 ) {
|
||||
if ( vendor == (uint32_t)-1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ ssize_t console_write_support (
|
||||
size_t len
|
||||
)
|
||||
{
|
||||
int nwrite = 0;
|
||||
size_t nwrite = 0;
|
||||
const char *buf = bufarg;
|
||||
|
||||
while (nwrite < len) {
|
||||
|
||||
@@ -100,7 +100,7 @@ console_tbl* console_find_console_entry(
|
||||
*/
|
||||
void console_initialize_data(void)
|
||||
{
|
||||
int i;
|
||||
uint32_t i;
|
||||
|
||||
if ( Console_Port_Tbl )
|
||||
return;
|
||||
@@ -140,8 +140,8 @@ void console_register_devices(
|
||||
size_t number_of_ports
|
||||
)
|
||||
{
|
||||
int old_number_of_ports;
|
||||
int i;
|
||||
int old_number_of_ports;
|
||||
size_t i;
|
||||
|
||||
/*
|
||||
* Initialize the console data elements
|
||||
|
||||
@@ -90,7 +90,7 @@ static void versal_uart_interrupt(void *arg)
|
||||
|
||||
if ((uartmis & (PL011_UARTI_RTI | PL011_UARTI_RXI)) != 0) {
|
||||
char buf[32];
|
||||
int c = 0;
|
||||
size_t c = 0;
|
||||
while (c < sizeof(buf) &&
|
||||
versal_uart_flags_clear(regs, PL011_UARTFR_RXFE)) {
|
||||
buf[c++] = (char) PL011_UARTDR_DATA_GET(regs->base.uartdr);
|
||||
@@ -254,7 +254,7 @@ static void versal_uart_write_support(
|
||||
ctx->transmitting = true;
|
||||
}
|
||||
#else
|
||||
ssize_t i;
|
||||
size_t i;
|
||||
for (i = 0; i < len; ++i) {
|
||||
arm_pl011_write_polled(base, buf[i]);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ static void zynq_uart_interrupt(void *arg)
|
||||
|
||||
if ((regs->irq_sts & ZYNQ_UART_RTRIG) != 0) {
|
||||
char buf[32];
|
||||
int c = 0;
|
||||
size_t c = 0;
|
||||
regs->irq_sts = ZYNQ_UART_RTRIG;
|
||||
while (c < sizeof(buf) &&
|
||||
(regs->channel_sts & ZYNQ_UART_CHANNEL_STS_REMPTY) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user