exit_detach: i2c_detach_client(new_client); 
static int lm87_detect(struct i2c_adapter *adapter, int address, int kind){	struct i2c_client *new_client;	struct lm87_data *data;	int err = 0;	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))		goto exit;	if (!(data = kmalloc(sizeof(struct lm87_data), GFP_KERNEL))) {		err = -ENOMEM;		goto exit;	}	memset(data, 0, sizeof(struct lm87_data));	/* The common I2C client data is placed right before the	   LM87-specific data. */	new_client = &data->client;	i2c_set_clientdata(new_client, data);	new_client->addr = address;	new_client->adapter = adapter;	new_client->driver = &lm87_driver;	new_client->flags = 0;	/* Default to an LM87 if forced */	if (kind == 0)		kind = lm87;	/* Now, we do the remaining detection. */	if (kind < 0) {		u8 rev = lm87_read_value(new_client, LM87_REG_REVISION);		if (rev < 0x01 || rev > 0x08		 || (lm87_read_value(new_client, LM87_REG_CONFIG) & 0x80)		 || lm87_read_value(new_client, LM87_REG_COMPANY_ID) != 0x02) {			dev_dbg(&adapter->dev,				"LM87 detection failed at 0x%02x.\n",				address);			goto exit_free;		}	}	/* We can fill in the remaining client fields */	strlcpy(new_client->name, "lm87", I2C_NAME_SIZE);	data->valid = 0;	init_MUTEX(&data->update_lock);	/* Tell the I2C layer a new client has arrived */	if ((err = i2c_attach_client(new_client)))		goto exit_free;	/* Initialize the LM87 chip */	lm87_init_client(new_client);	data->in_scale[0] = 2500;	data->in_scale[1] = 2700;	data->in_scale[2] = (data->channel & CHAN_VCC_5V) ? 5000 : 3300;	data->in_scale[3] = 5000;	data->in_scale[4] = 12000;	data->in_scale[5] = 2700;	data->in_scale[6] = 1875;	data->in_scale[7] = 1875;	/* Register sysfs hooks */	device_create_file(&new_client->dev, &dev_attr_in1_input);	device_create_file(&new_client->dev, &dev_attr_in1_min);	device_create_file(&new_client->dev, &dev_attr_in1_max);	device_create_file(&new_client->dev, &dev_attr_in2_input);	device_create_file(&new_client->dev, &dev_attr_in2_min);	device_create_file(&new_client->dev, &dev_attr_in2_max);	device_create_file(&new_client->dev, &dev_attr_in3_input);	device_create_file(&new_client->dev, &dev_attr_in3_min);	device_create_file(&new_client->dev, &dev_attr_in3_max);	device_create_file(&new_client->dev, &dev_attr_in4_input);	device_create_file(&new_client->dev, &dev_attr_in4_min);	device_create_file(&new_client->dev, &dev_attr_in4_max);	if (data->channel & CHAN_NO_FAN(0)) {		device_create_file(&new_client->dev, &dev_attr_in6_input);		device_create_file(&new_client->dev, &dev_attr_in6_min);		device_create_file(&new_client->dev, &dev_attr_in6_max);	} else {		device_create_file(&new_client->dev, &dev_attr_fan1_input);		device_create_file(&new_client->dev, &dev_attr_fan1_min);		device_create_file(&new_client->dev, &dev_attr_fan1_div);	}	if (data->channel & CHAN_NO_FAN(1)) {		device_create_file(&new_client->dev, &dev_attr_in7_input);		device_create_file(&new_client->dev, &dev_attr_in7_min);		device_create_file(&new_client->dev, &dev_attr_in7_max);	} else {		device_create_file(&new_client->dev, &dev_attr_fan2_input);		device_create_file(&new_client->dev, &dev_attr_fan2_min);		device_create_file(&new_client->dev, &dev_attr_fan2_div);	}	device_create_file(&new_client->dev, &dev_attr_temp1_input);	device_create_file(&new_client->dev, &dev_attr_temp1_max);	device_create_file(&new_client->dev, &dev_attr_temp1_min);	device_create_file(&new_client->dev, &dev_attr_temp1_crit);	device_create_file(&new_client->dev, &dev_attr_temp2_input);	device_create_file(&new_client->dev, &dev_attr_temp2_max);	device_create_file(&new_client->dev, &dev_attr_temp2_min);	device_create_file(&new_client->dev, &dev_attr_temp2_crit);	if (data->channel & CHAN_TEMP3) {		device_create_file(&new_client->dev, &dev_attr_temp3_input);		device_create_file(&new_client->dev, &dev_attr_temp3_max);		device_create_file(&new_client->dev, &dev_attr_temp3_min);		device_create_file(&new_client->dev, &dev_attr_temp3_crit);	} else {		device_create_file(&new_client->dev, &dev_attr_in0_input);		device_create_file(&new_client->dev, &dev_attr_in0_min);		device_create_file(&new_client->dev, &dev_attr_in0_max);		device_create_file(&new_client->dev, &dev_attr_in5_input);		device_create_file(&new_client->dev, &dev_attr_in5_min);		device_create_file(&new_client->dev, &dev_attr_in5_max);	}	if (!(data->channel & CHAN_NO_VID)) {		device_create_file(&new_client->dev, &dev_attr_cpu0_vid);		device_create_file(&new_client->dev, &dev_attr_vrm);	}	device_create_file(&new_client->dev, &dev_attr_alarms);	device_create_file(&new_client->dev, &dev_attr_aout_output);	return 0;exit_free:	kfree(data);exit:	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/943b0830cebe4711354945ed3cb44e84152aaca0/lm87.c/clean/drivers/hwmon/lm87.c