diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-07 11:58:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-07 14:31:46 -0500 |
commit | 969affd276dec81a35a5ad10d4e05e62e93b380b (patch) | |
tree | a6a6bb9f2b658838f09ad28d58211252a5e7db6f | |
parent | 7d640c4a5b36c4733460065db1554da924044511 (diff) |
sysfs: remove BUG_ON() from sysfs_remove_group()
It's possible that the caller of sysfs_remove_group messed up and passed in an attribute group that was not really registered to this kobject. But don't panic for such a foolish error, spit out a warning about what happened, and continue on our way safely.
Cc: Roland Dreier <rdreier@cisco.com>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | fs/sysfs/group.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 0871c3dadce1..477904915032 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
@@ -77,7 +77,12 @@ void sysfs_remove_group(struct kobject * kobj, | |||
77 | 77 | ||
78 | if (grp->name) { | 78 | if (grp->name) { |
79 | sd = sysfs_get_dirent(dir_sd, grp->name); | 79 | sd = sysfs_get_dirent(dir_sd, grp->name); |
80 | BUG_ON(!sd); | 80 | if (!sd) { |
81 | printk(KERN_WARNING "sysfs group %p not found for " | ||
82 | "kobject '%s'\n", grp, kobject_name(kobj)); | ||
83 | WARN_ON(!sd); | ||
84 | return; | ||
85 | } | ||
81 | } else | 86 | } else |
82 | sd = sysfs_get(dir_sd); | 87 | sd = sysfs_get(dir_sd); |
83 | 88 | ||