Felix Held has uploaded this change for review.

View Change

soc/amd/picasso/uart: make index parameters unsigned

The UART index is never negative, so make it unsigned and drop the check
for the index to be non-negative.

BRANCH=zork

Change-Id: I38b5dad87f8af4fbe8ee1d919230efe48f68686c
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
---
M src/soc/amd/picasso/include/soc/uart.h
M src/soc/amd/picasso/uart.c
2 files changed, 6 insertions(+), 6 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/92/45292/1
diff --git a/src/soc/amd/picasso/include/soc/uart.h b/src/soc/amd/picasso/include/soc/uart.h
index 3aac936..4e5619f 100644
--- a/src/soc/amd/picasso/include/soc/uart.h
+++ b/src/soc/amd/picasso/include/soc/uart.h
@@ -5,9 +5,9 @@

#include <types.h>

-void set_uart_config(int idx); /* configure hardware of FCH UART selected by idx */
+void set_uart_config(unsigned int idx); /* configure hardware of FCH UART selected by idx */
void clear_uart_legacy_config(void); /* disable legacy I/O decode for FCH UART */

-uintptr_t get_uart_base(int idx); /* get MMIO base address of FCH UART */
+uintptr_t get_uart_base(unsigned int idx); /* get MMIO base address of FCH UART */

#endif /* __PICASSO_UART_H__ */
diff --git a/src/soc/amd/picasso/uart.c b/src/soc/amd/picasso/uart.c
index d892333..0bf7eb8 100644
--- a/src/soc/amd/picasso/uart.c
+++ b/src/soc/amd/picasso/uart.c
@@ -32,9 +32,9 @@
} },
};

-uintptr_t get_uart_base(int idx)
+uintptr_t get_uart_base(unsigned int idx)
{
- if (idx < 0 || idx >= ARRAY_SIZE(uart_info))
+ if (idx >= ARRAY_SIZE(uart_info))
return 0;

return uart_info[idx].base;
@@ -45,12 +45,12 @@
write16((void *)FCH_UART_LEGACY_DECODE, 0);
}

-void set_uart_config(int idx)
+void set_uart_config(unsigned int idx)
{
uint32_t uart_ctrl;
uint16_t uart_leg;

- if (idx < 0 || idx >= ARRAY_SIZE(uart_info))
+ if (idx >= ARRAY_SIZE(uart_info))
return;

program_gpios(uart_info[idx].mux, 2);

To view, visit change 45292. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I38b5dad87f8af4fbe8ee1d919230efe48f68686c
Gerrit-Change-Number: 45292
Gerrit-PatchSet: 1
Gerrit-Owner: Felix Held <felix-coreboot@felixheld.de>
Gerrit-MessageType: newchange