From: Philippe Mathieu-Daudé Date: Mon, 21 Jan 2019 10:23:10 +0000 (+0000) Subject: hw/char/stm32f2xx_usart: Do not update data register when device is disabled X-Git-Tag: v4.0.0-rc0~157^2~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4076618095099702e0a29e47aac30b4931a1f54b;p=thirdparty%2Fqemu.git hw/char/stm32f2xx_usart: Do not update data register when device is disabled When the device is disabled, the internal circuitry keeps the data register loaded and doesn't update it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-id: 20190104182057.8778-1-philmd@redhat.com Signed-off-by: Peter Maydell --- diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index f3363a2952d..10392c70e2d 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -53,14 +53,13 @@ static void stm32f2xx_usart_receive(void *opaque, const uint8_t *buf, int size) { STM32F2XXUsartState *s = opaque; - s->usart_dr = *buf; - if (!(s->usart_cr1 & USART_CR1_UE && s->usart_cr1 & USART_CR1_RE)) { /* USART not enabled - drop the chars */ DB_PRINT("Dropping the chars\n"); return; } + s->usart_dr = *buf; s->usart_sr |= USART_SR_RXNE; if (s->usart_cr1 & USART_CR1_RXNEIE) {