lkml.org 
[lkml]   [2007]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] kobject: make sure kobj->ktype is set before kobject_init
From
Date
On Wed, 2007-11-28 at 15:42 -0500, Alan Stern wrote:
> This patch (as1020) adds a check to kobject_init() to insure that the
> ktype field is not NULL.

That's good.

> This is just for safety's sake; as far as I
> know there are no remaining places where the field is left unset. But
> ironically, kset_init() did fail to set it!

Nice to have that fixed.

> The patch fixes that and
> removes some redundant initialization in kset_createa().
>
> The patch also fixes up elevator_init(), where ktype was set after
> calling kobject_init() instead of before.

It should not harm, only the kset was needed before _init(), but even
that should be history with Greg's latest patch:
http://git.kernel.org/?p=linux/kernel/git/gregkh/patches.git;a=blob;f=driver/kobject-grab-the-kset-reference-in-kobject_add-not-kobject_init.patch;hb=HEAD

> Here is the check we discussed. I'm a little behind on Kay's most
> recent updates; I hope this doesn't clash with them.
>
> There may be some other places where ktype gets set after
> kobject_init() rather than before. My testing can't be termendously
> thorough. But they should all be easy to fix (like elevator.c was)

I think it's fine and elevator does not need to be changed, and we can
remove the requirement now from the documentation, as _init() now does
not depend on any pre-assigned values, right?

Kay

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-28 21:55    [W:0.040 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site