Re: [PATCH v3 1/4] serial: revert guards in uart_wait_modem_status()

From: Johan Hovold

Date: Mon Sep 07 2026 - 03:50:15 EST


On Mon, Sep 07, 2026 at 08:51:26AM +0200, Jiri Slaby wrote:
> On 07. 09. 26, 8:47, Jiri Slaby wrote:
> > On 07. 09. 26, 8:44, Johan Hovold wrote:
> >> Mixing scope-based and regular cleanup is discouraged and
> >> uart_port_deref() used by uart_wait_modem_status() falls in the latter
> >> category.
> >>
> >> Revert the premature guard conversion in preparation for fixing a hangup
> >> race.
> >
> > It's not premature. Just convert uart_port_ref() to guards too. Gotos suck.
>
> (Or don't use gotos and I will.)

I guess you meant "don't use guards" here. :)

Gotos don't suck. Obscure driver-specific guard constructs do, though.

So I'm with netdev here, who discourage its use. [1]

I haven't missed your fondness of them, though, and if you want to
continue that path I think it's best if you do it as a follow-on change
(e.g. to facilitate backporting and as it is a larger change to the
driver, unrelated to the fix).

Johan


[1] https://docs.kernel.org/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs