diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2006-11-27 04:35:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-07 13:37:12 -0500 |
commit | cb360bbf6352712310a7528137919c626a782744 (patch) | |
tree | c1dc84eb9b026c61256914e26624a5879c0f9951 /drivers/base/core.c | |
parent | 270a6c4cad809e92d7b81adde92d0b3d94eeb8ee (diff) |
driver core fixes: make_class_name() retval checks
Make make_class_name() return NULL on error and fixup callers in the
driver core.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index c60114dbe5f5..6fee3e6b1ac2 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -527,9 +527,13 @@ int device_add(struct device *dev) | |||
527 | &dev->kobj, dev->bus_id); | 527 | &dev->kobj, dev->bus_id); |
528 | #ifdef CONFIG_SYSFS_DEPRECATED | 528 | #ifdef CONFIG_SYSFS_DEPRECATED |
529 | if (parent) { | 529 | if (parent) { |
530 | sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device"); | 530 | sysfs_create_link(&dev->kobj, &dev->parent->kobj, |
531 | class_name = make_class_name(dev->class->name, &dev->kobj); | 531 | "device"); |
532 | sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name); | 532 | class_name = make_class_name(dev->class->name, |
533 | &dev->kobj); | ||
534 | if (class_name) | ||
535 | sysfs_create_link(&dev->parent->kobj, | ||
536 | &dev->kobj, class_name); | ||
533 | } | 537 | } |
534 | #endif | 538 | #endif |
535 | } | 539 | } |
@@ -672,7 +676,9 @@ void device_del(struct device * dev) | |||
672 | if (parent) { | 676 | if (parent) { |
673 | char *class_name = make_class_name(dev->class->name, | 677 | char *class_name = make_class_name(dev->class->name, |
674 | &dev->kobj); | 678 | &dev->kobj); |
675 | sysfs_remove_link(&dev->parent->kobj, class_name); | 679 | if (class_name) |
680 | sysfs_remove_link(&dev->parent->kobj, | ||
681 | class_name); | ||
676 | kfree(class_name); | 682 | kfree(class_name); |
677 | sysfs_remove_link(&dev->kobj, "device"); | 683 | sysfs_remove_link(&dev->kobj, "device"); |
678 | } | 684 | } |
@@ -975,8 +981,7 @@ static int device_move_class_links(struct device *dev, | |||
975 | 981 | ||
976 | class_name = make_class_name(dev->class->name, &dev->kobj); | 982 | class_name = make_class_name(dev->class->name, &dev->kobj); |
977 | if (!class_name) { | 983 | if (!class_name) { |
978 | error = PTR_ERR(class_name); | 984 | error = -ENOMEM; |
979 | class_name = NULL; | ||
980 | goto out; | 985 | goto out; |
981 | } | 986 | } |
982 | if (old_parent) { | 987 | if (old_parent) { |