ChangeSet 1.1803.64.4, 2004/08/10 14:49:28-07:00, thomas.koeller@baslerweb.com [PATCH] Driver Core: fix minor class reference counting issue on the error path Signed-off-by: Thomas Koeller Signed-off-by: Greg Kroah-Hartman drivers/base/class.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff -Nru a/drivers/base/class.c b/drivers/base/class.c --- a/drivers/base/class.c 2004-08-25 14:56:30 -07:00 +++ b/drivers/base/class.c 2004-08-25 14:56:30 -07:00 @@ -349,13 +349,18 @@ int class_device_add(struct class_device *class_dev) { - struct class * parent; + struct class * parent = NULL; struct class_interface * class_intf; int error; class_dev = class_device_get(class_dev); - if (!class_dev || !strlen(class_dev->class_id)) + if (!class_dev) return -EINVAL; + + if (!strlen(class_dev->class_id)) { + error = -EINVAL; + goto register_done; + } parent = class_get(class_dev->class);