Re: [PATCH v3 4/5] console: Avoid positive return code from unregister_console()
From: Andy Shevchenko
Date: Thu Jan 30 2020 - 08:13:32 EST
On Thu, Jan 30, 2020 at 01:22:26PM +0100, Petr Mladek wrote:
> On Thu 2020-01-30 11:58:07, Andy Shevchenko wrote:
> > On Thu, Jan 30, 2020 at 10:04:29AM +0100, Petr Mladek wrote:
...
> > Okay, I understand that for time being it's matter of how eloquent
> > the commit message will be. (And maybe some comments in the code?)
> > Is it correct?
>
> Good question.
>
> Please, remove the last hunk if Sergey is not against it.
> I think that the success/error should not depend on the state
> of CON_ENABLED flag.
If I understood his last message correctly, he is exactly in favour of not
using it (and thus changing conditional for ->exit() callback to rely only
on res value).
> The other two changes might stay in the same patch. We just need
> to make the commit message easier to understand. I would write
> something like:
Thanks! Will do this way.
> <begin>
> There are only two callers that use the returned code from
> unregister_console():
>
> + unregister_early_console() in arch/m68k/kernel/early_printk.c
> + kgdb_unregister_nmi_console() in drivers/tty/serial/kgdb_nmi.c
>
> They both expect to get "0" on success and a non-zero value on error.
> But the current behavior is confusing and buggy:
>
> + _braille_unregister_console() returns "1" on success
> + unregister_console() returns "1" on error
>
> Fix and clean up the behavior:
>
> + Return success when _braille_unregister_console() succeeded.
> + Return a meaningful error code when the console was not
> registered before.
> </end>
--
With Best Regards,
Andy Shevchenko