Prior to this fix, if the UART hardware FIFO had a few chars but still below the FIFO trigger threshold, and the ringbuf was empty, the read function would timeout if timeout==0 (the default timeout). This fix follows the suggestion of @iabdalkader.