When this is called in the register error case, I think func->mod could be uninitialized at this point.  Maybe change the funcs array kmalloc to kzalloc?