Messages in this thread |  | | Date | Tue, 28 Jan 2020 13:43:32 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [PATCH v3 4/5] console: Avoid positive return code from unregister_console() |
| |
On (20/01/27 13:47), Andy Shevchenko wrote: [..] > res = _braille_unregister_console(console); > - if (res) > + if (res < 0) > return res; > + if (res > 0) > + return 0; > > - res = 1; > + res = -ENODEV; > console_lock(); > if (console_drivers == console) { > console_drivers=console->next; > @@ -2838,6 +2840,9 @@ int unregister_console(struct console *console) > if (!res && (console->flags & CON_EXTENDED)) > nr_ext_console_drivers--; > > + if (res && !(console->flags & CON_ENABLED)) > + res = 0;
Console is not on the console_drivers list. Why does !ENABLED case require extra handling? What about the case when console is ENABLED but still not registered?
I think that if the console is not on the list (was never registered) then we can just bail out, without console_sysfs_notify(), etc. IOW,
if (res) { console->flags &= ~CON_ENABLED; /* just in case */ console_unlock(); return res; }
-ss
|  |