[Skiboot] [PATCH v2 2/2] hw/lpc-uart.c: Handle read failure case in UART communication

Reza Arbab arbab at linux.ibm.com
Sat May 17 01:06:35 AEST 2025


On Fri, Apr 11, 2025 at 03:11:45PM +0530, Aditya Gupta wrote:
>On 25/04/10 06:13AM, ABHISHEK SINGH TOMAR wrote:
>> From: Abhishek Singh Tomar <abhishek at linux.ibm.com>
>> <...snip...>
>>
>> -	if (uart_read(REG_LSR) & LSR_THRE) {
>> +	reg = uart_read(REG_LSR);
>> +	if (reg & LSR_THRE && reg != 0xff) {
>
>Nitpick: Maybe we can have: ((reg & LSR_THRE) && (reg != 0xff)). That
>seems more clear at what is being compared.

I think the most readable is to use two if statements:

	reg = uart_read(REG_LSR);
	if (reg == 0xff)
		return false;

	if (reg & LSR_THRE) {
		...
	}

Fixed the patch up as above and applied to master.

-- 
Reza Arbab


More information about the Skiboot mailing list