On Mon, Nov 03, 2014 at 03:06:07PM +0000, Daniel Thompson wrote:
kfree is a nop when the argument is NULL, which is a crucial property of this - memset would oops on driver load.
Oops. Missed that (I think I misread who as assuming there was always obj->state in the patch header).
Do you fancy making the comment "by freeing the state pointer and allocating a new..." into "by freeing the state pointer (which may be NULL) and allocating a new...".
If nothing else that means the documentation is richer than the code...
Yeah, sounds like a good idea. I'll also mention that this is for driver load mostly (if the driver doesn't decide to throw away the state for some reason over suspend/resume). -Daniel