if (found) { /* a slave was found that is using the mac address * of the new slave */ printk(KERN_ERR DRV_NAME ": Error: the hw address of slave %s is not " "unique - cannot enslave it!", slave->dev->name); return -EINVAL; } 
if (!found) return 0; 
static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave){	struct slave *tmp_slave1, *tmp_slave2, *free_mac_slave;	struct slave *has_bond_addr = bond->curr_active_slave;	int i, j, found = 0;	if (bond->slave_cnt == 0) {		/* this is the first slave */		return 0;	}	/* if slave's mac address differs from bond's mac address	 * check uniqueness of slave's mac address against the other	 * slaves in the bond.	 */	if (memcmp(slave->perm_hwaddr, bond->dev->dev_addr, ETH_ALEN)) {		bond_for_each_slave(bond, tmp_slave1, i) {			if (!memcmp(tmp_slave1->dev->dev_addr, slave->dev->dev_addr,				    ETH_ALEN)) {				found = 1;				break;			}		}		if (found) {			/* a slave was found that is using the mac address			 * of the new slave			 */			printk(KERN_ERR DRV_NAME			       ": Error: the hw address of slave %s is not "			       "unique - cannot enslave it!",			       slave->dev->name);			return -EINVAL;		}		return 0;	}	/* The slave's address is equal to the address of the bond.	 * Search for a spare address in the bond for this slave.	 */	free_mac_slave = NULL;	bond_for_each_slave(bond, tmp_slave1, i) {		found = 0;		bond_for_each_slave(bond, tmp_slave2, j) {			if (!memcmp(tmp_slave1->perm_hwaddr,				    tmp_slave2->dev->dev_addr,				    ETH_ALEN)) {				found = 1;				break;			}		}		if (!found) {			/* no slave has tmp_slave1's perm addr			 * as its curr addr			 */			free_mac_slave = tmp_slave1;			break;		}		if (!has_bond_addr) {			if (!memcmp(tmp_slave1->dev->dev_addr,				    bond->dev->dev_addr,				    ETH_ALEN)) {				has_bond_addr = tmp_slave1;			}		}	}	if (free_mac_slave) {		alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,				       bond->alb_info.rlb_enabled);		printk(KERN_WARNING DRV_NAME		       ": Warning: the hw address of slave %s is in use by "		       "the bond; giving it the hw address of %s\n",		       slave->dev->name, free_mac_slave->dev->name);	} else if (has_bond_addr) {		printk(KERN_ERR DRV_NAME		       ": Error: the hw address of slave %s is in use by the "		       "bond; couldn't find a slave with a free hw address to "		       "give it (this should not have happened)\n",		       slave->dev->name);		return -EFAULT;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6b38aefe924daf2e4fdd73b384f21c913f31b668/bond_alb.c/buggy/drivers/net/bonding/bond_alb.c