ret = alloc_group(&p->gid_attr, show_port_gid, attr.gid_tbl_len); if (ret) 
p->gid_group.name  = "gids"; p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); if (!p->gid_group.attrs) 
static int add_port(struct ib_device *device, int port_num){	struct ib_port *p;	struct ib_port_attr attr;	int i;	int ret;	ret = ib_query_port(device, port_num, &attr);	if (ret)		return ret;	p = kmalloc(sizeof *p, GFP_KERNEL);	if (!p)		return -ENOMEM;	memset(p, 0, sizeof *p);	p->ibdev      = device;	p->port_num   = port_num;	p->kobj.ktype = &port_type;	p->kobj.parent = kobject_get(&device->ports_parent);	if (!p->kobj.parent) {		ret = -EBUSY;		goto err;	}	ret = kobject_set_name(&p->kobj, "%d", port_num);	if (ret)		goto err_put;	ret = kobject_register(&p->kobj);	if (ret)		goto err_put;	ret = sysfs_create_group(&p->kobj, &pma_group);	if (ret)		goto err_put;	ret = alloc_group(&p->gid_attr, show_port_gid, attr.gid_tbl_len);	if (ret)		goto err_remove_pma;	p->gid_group.name  = "gids";	p->gid_group.attrs = p->gid_attr;	ret = sysfs_create_group(&p->kobj, &p->gid_group);	if (ret)		goto err_free_gid;	ret = alloc_group(&p->pkey_attr, show_port_pkey, attr.pkey_tbl_len);	if (ret)		goto err_remove_gid;	p->pkey_group.name  = "pkeys";	p->pkey_group.attrs = p->pkey_attr;	ret = sysfs_create_group(&p->kobj, &p->pkey_group);	if (ret)		goto err_free_pkey;	list_add_tail(&p->kobj.entry, &device->port_list);	return 0;err_free_pkey:	for (i = 0; i < attr.pkey_tbl_len; ++i) {		kfree(p->pkey_attr[i]->name);		kfree(p->pkey_attr[i]);	}	kfree(p->pkey_attr);err_remove_gid:	sysfs_remove_group(&p->kobj, &p->gid_group);err_free_gid:	for (i = 0; i < attr.gid_tbl_len; ++i) {		kfree(p->gid_attr[i]->name);		kfree(p->gid_attr[i]);	}	kfree(p->gid_attr);err_remove_pma:	sysfs_remove_group(&p->kobj, &pma_group);err_put:	kobject_put(&device->ports_parent);err:	kfree(p);	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d48593bf208e0d046c35fb0707ae5b23fef8c4ff/sysfs.c/clean/drivers/infiniband/core/sysfs.c