[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9c3d387c-0ee1-4f53-b4fe-2c2783e5650c@kernel.org>
Date: Mon, 23 Jun 2025 09:05:46 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>,
"Maciej S. Szmigiero" <mail@...iej.szmigiero.name>
Cc: Andy Shevchenko <andriy.shevchenko@...el.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
gregkh@...uxfoundation.org, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 30/33] serial: 8250: invert
serial8250_register_8250_port() CIR condition
On 21. 06. 25, 21:08, Andy Shevchenko wrote:
> Fri, Jun 20, 2025 at 11:48:09PM +0200, Maciej S. Szmigiero kirjoitti:
>> On 18.06.2025 07:48, Andy Shevchenko wrote:
>>> On Wed, Jun 11, 2025 at 12:03:16PM +0200, Jiri Slaby (SUSE) wrote:
>
> ...
>
>>>> + if (uart->port.type == PORT_8250_CIR) {
>>>> + ret = -ENODEV;
>>>> + goto unlock;
>>>> + }
>>>
>>>> + if (up->port.flags & UPF_FIXED_TYPE)
>>>> + uart->port.type = up->port.type;
>>>
>>>> + if (uart->port.type != PORT_8250_CIR) {
>>>
>>> I admit that there tons of mysterious ways of UART initialisation, but can you
>>> elaborate how this is not a always-true conditional?
>>
>> Careful here, someone had an idea in the past that this is indeed
>> a dead code/branch and ended causing a regression [1].
Right, I was confused too, but then I noticed there is:
uart->port.type = up->port.type;
in between the tests.
>> It would definitely make sense to add a comment describing the code
>> flow there though as it proven to bewilder people.
>
> Yes, this is my point between the lines. I left the code that may affect the
> type change and the second check needs a comment explaining these cases, if any.
> "If any" defines "always-true" or not conditional. W//o a comment this code
> tends to be updated again and lead to a regression.
ACK, I will.
--
js
suse labs
Powered by blists - more mailing lists