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

From: Greg KH
Date: Fri Apr 14 2006 - 16:11:52 EST


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: Jayachandran C. <c.jayachandran@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---

drivers/base/class.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)

a14388904ca67197c9a531dba2358d8131697865
diff --git a/drivers/base/class.c b/drivers/base/class.c
index df7fdab..0e71dff 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -562,14 +562,13 @@ int class_device_add(struct class_device
kobject_uevent(&class_dev->kobj, KOBJ_ADD);

/* notify any interfaces this device is now here */
- if (parent_class) {
- down(&parent_class->sem);
- list_add_tail(&class_dev->node, &parent_class->children);
- list_for_each_entry(class_intf, &parent_class->interfaces, node)
- if (class_intf->add)
- class_intf->add(class_dev, class_intf);
- up(&parent_class->sem);
+ down(&parent_class->sem);
+ list_add_tail(&class_dev->node, &parent_class->children);
+ list_for_each_entry(class_intf, &parent_class->interfaces, node) {
+ if (class_intf->add)
+ class_intf->add(class_dev, class_intf);
}
+ up(&parent_class->sem);

register_done:
if (error) {
--
1.2.6


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