memset(attr, sizeof(*attr), 0x00); 
int class_device_add(struct class_device *class_dev){	struct class * parent = NULL;	struct class_interface * class_intf;	char *class_name = NULL;	int error;	class_dev = class_device_get(class_dev);	if (!class_dev)		return -EINVAL;	if (!strlen(class_dev->class_id)) {		error = -EINVAL;		goto register_done;	}	parent = class_get(class_dev->class);	pr_debug("CLASS: registering class device: ID = '%s'\n",		 class_dev->class_id);	/* first, register with generic layer. */	kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id);	if (parent)		class_dev->kobj.parent = &parent->subsys.kset.kobj;	if ((error = kobject_add(&class_dev->kobj)))		goto register_done;	/* add the needed attributes to this device */	if (MAJOR(class_dev->devt)) {		struct class_device_attribute *attr;		attr = kmalloc(sizeof(*attr), GFP_KERNEL);		if (!attr) {			error = -ENOMEM;			kobject_del(&class_dev->kobj);			goto register_done;		}		memset(attr, sizeof(*attr), 0x00);		attr->attr.name = "dev";		attr->attr.mode = S_IRUGO;		attr->attr.owner = parent->owner;		attr->show = show_dev;		attr->store = NULL;		class_device_create_file(class_dev, attr);		class_dev->devt_attr = attr;	}	class_device_add_attrs(class_dev);	if (class_dev->dev) {		class_name = make_class_name(class_dev);		sysfs_create_link(&class_dev->kobj,				  &class_dev->dev->kobj, "device");		sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,				  class_name);	}	/* notify any interfaces this device is now here */	if (parent) {		down(&parent->sem);		list_add_tail(&class_dev->node, &parent->children);		list_for_each_entry(class_intf, &parent->interfaces, node)			if (class_intf->add)				class_intf->add(class_dev);		up(&parent->sem);	}	kobject_hotplug(&class_dev->kobj, KOBJ_ADD); register_done:	if (error && parent)		class_put(parent);	class_device_put(class_dev);	kfree(class_name);	return error;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/4aed0644d684428e811bb6944f032b460a3ab165/class.c/clean/drivers/base/class.c