On Tue, Oct 24, 2006 at 01:34:34PM +1000, Benjamin Herrenschmidt wrote:> On Mon, 2006-10-23 at 13:19 -0400, Neil Horman wrote:> > Hey All-> > Janitor patch to clean up return code handling and exit from failed> > calls to misc_register accross several modules.> > The patch doesn't match the description... What are those INIT_LIST_HEAD> things ? Is this something I've missed or is this a new requirement for> all misc devices ? Can't it be statically initialized instead ?>

The INIT_LIST_HEAD is there to prevent a potential oops on module removal.misc_register, if it fails, leaves miscdevice.list unchanged. That means itsnext and prev pointers contain NULL or garbage, when both pointers should contain&miscdevice.list. If we don't do that, then there is a chance we will oops onmodule removal when we do a list_del in misc_deregister on the moudule_exitroutine. I could have done this statically, but I thought it looked cleaner todo it with the macro in the code.