From 11cf6ae3e24a33a75ed18bc49585149d4e97a4e0 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 10 Jun 2021 15:14:37 +0200 Subject: grlib: Simplify apbuart_inbyte_nonblocking() --- bsps/shared/grlib/uart/apbuart_polled.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bsps') diff --git a/bsps/shared/grlib/uart/apbuart_polled.c b/bsps/shared/grlib/uart/apbuart_polled.c index bf23e3a892..87325d8951 100644 --- a/bsps/shared/grlib/uart/apbuart_polled.c +++ b/bsps/shared/grlib/uart/apbuart_polled.c @@ -35,11 +35,11 @@ void apbuart_outbyte_polled(struct apbuart_regs *regs, char ch) int apbuart_inbyte_nonblocking(struct apbuart_regs *regs) { /* Clear errors */ - if (regs->status & APBUART_STATUS_ERR) - regs->status = ~APBUART_STATUS_ERR; + regs->status = ~APBUART_STATUS_ERR; - if ((regs->status & APBUART_STATUS_DR) == 0) + if ((regs->status & APBUART_STATUS_DR) == 0) { return -1; - else - return (int) regs->data; + } + + return (uint8_t) regs->data; } -- cgit v1.2.3