On Fri, 5 Sep 2025 17:00:21 +0530 Sidharth Seela <sidharthse...@gmail.com> wrote:
> On Fri, Sep 5, 2025 at 4:55 PM Kory Maincent <kory.mainc...@bootlin.com> > wrote: > > > > This seems weird. == precede in terms of priority to &&, therefore the > > parentheses should not be needed here. > > > is the issue maybe left to right interpretation of code? Indeed inverting the condition will change the behavior, but is it really the issue here. With the current condition test, serial_tstc() is called then if it return something not null, serial_getc() will read one character and compare it to 'c'. According to documentation: serial_tstc() - Test if data is available on currently selected serial port serial_getc() - Read character from currently selected serial port I think the current order is correct, we should test available data before reading it. Your issue may be somewhere else. Regards, -- Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com