Commit a1438890 authored by Jayachandran C's avatar Jayachandran C Committed by Greg Kroah-Hartman

[PATCH] driver core: fix unnecessary NULL check in drivers/base/class.c

This patch tries to fix an issue in drivers/base/class.c, please
review and apply if correct.

Patch Description:
  "parent_class" is checked for NULL already, so removed the unnecessary
  check.
Signed-off-by: default avatarJayachandran C. <c.jayachandran@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d4d7e5df
...@@ -562,14 +562,13 @@ int class_device_add(struct class_device *class_dev) ...@@ -562,14 +562,13 @@ int class_device_add(struct class_device *class_dev)
kobject_uevent(&class_dev->kobj, KOBJ_ADD); kobject_uevent(&class_dev->kobj, KOBJ_ADD);
/* notify any interfaces this device is now here */ /* notify any interfaces this device is now here */
if (parent_class) { down(&parent_class->sem);
down(&parent_class->sem); list_add_tail(&class_dev->node, &parent_class->children);
list_add_tail(&class_dev->node, &parent_class->children); list_for_each_entry(class_intf, &parent_class->interfaces, node) {
list_for_each_entry(class_intf, &parent_class->interfaces, node) if (class_intf->add)
if (class_intf->add) class_intf->add(class_dev, class_intf);
class_intf->add(class_dev, class_intf);
up(&parent_class->sem);
} }
up(&parent_class->sem);
register_done: register_done:
if (error) { if (error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment