If you're talking about properly freeing the memory, I suppose it should
happen by doing something like the following in unregister_console():
if (!console_drivers)
/* free the class object under console lock */
...right? Let me know if I'm misunderstanding you.
You can't do that as the driver core should now be managing the
lifespace of that object. You can't "know" when the object's memory is
to be freed EXCEPT in the release function.
So free it there please.
Or do not tie the lifepan of the console class device object to the
console object, and keep it separate. I don't remember exactly how you
tied them together here, sorry.
> Do you ever free the class?
Currently no. What do you think about the above proposal to do it once the
console driver list is exhausted?
If the code can never be unloaded, no, don't worry about it.