Re: [PATCH v2] printk: Fix preferred console selection with multiple matches

From: Benjamin Herrenschmidt
Date: Mon Jan 06 2020 - 19:53:37 EST


On Mon, 2020-01-06 at 11:25 +0100, Petr Mladek wrote:
>
> I agree that the enums are more self-descriptive. My problem with it is
> that there are 5 values. I wanted to check how they were handled
> and neither 'con_matched' nor 'con_failed' were later used.
>
> I though how to improve it. And I ended with feeling that the enum
> did more harm then good. -E??? codes are a bit less descriptive
> but there are only two. The meaning can be explained easily by
> a comment above the function.
>
> If you want to keep the enum then please handle the return values
> by switch(). Or make it clear that all possible return values
> are handled properly.

Agreed. The enum was originally due to me trying to figure out all the
different cases happening separately from how we react to them. In fact
I'm not even convinced we don't have bugs in the latter (the failure
path of Braille consoles is dubious).

In any case, I'm back now, I'll try to respin this week.

Cheers,
Ben.