if (!(data = kmalloc(sizeof(struct lm80_data), GFP_KERNEL))) { 
if (!(data = kzalloc(sizeof(struct lm80_data), GFP_KERNEL))) { 
int lm80_detect(struct i2c_adapter *adapter, int address, int kind){	int i, cur;	struct i2c_client *new_client;	struct lm80_data *data;	int err = 0;	const char *name;	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))		goto exit;	/* OK. For now, we presume we have a valid client. We now create the	   client structure, even though we cannot fill it completely yet.	   But it allows us to access lm80_{read,write}_value. */	if (!(data = kmalloc(sizeof(struct lm80_data), GFP_KERNEL))) {		err = -ENOMEM;		goto exit;	}	memset(data, 0, sizeof(struct lm80_data));	new_client = &data->client;	i2c_set_clientdata(new_client, data);	new_client->addr = address;	new_client->adapter = adapter;	new_client->driver = &lm80_driver;	new_client->flags = 0;	/* Now, we do the remaining detection. It is lousy. */	if (lm80_read_value(new_client, LM80_REG_ALARM2) & 0xc0)		goto error_free;	for (i = 0x2a; i <= 0x3d; i++) {		cur = i2c_smbus_read_byte_data(new_client, i);		if ((i2c_smbus_read_byte_data(new_client, i + 0x40) != cur)		 || (i2c_smbus_read_byte_data(new_client, i + 0x80) != cur)		 || (i2c_smbus_read_byte_data(new_client, i + 0xc0) != cur))		    goto error_free;	}	/* Determine the chip type - only one kind supported! */	kind = lm80;	name = "lm80";	/* Fill in the remaining client fields and put it into the global list */	strlcpy(new_client->name, name, 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 error_free;	/* Initialize the LM80 chip */	lm80_init_client(new_client);	/* A few vars need to be filled upon startup */	data->fan_min[0] = lm80_read_value(new_client, LM80_REG_FAN_MIN(1));	data->fan_min[1] = lm80_read_value(new_client, LM80_REG_FAN_MIN(2));	/* Register sysfs hooks */	data->class_dev = hwmon_device_register(&new_client->dev);	if (IS_ERR(data->class_dev)) {		err = PTR_ERR(data->class_dev);		goto error_detach;	}	device_create_file(&new_client->dev, &dev_attr_in0_min);	device_create_file(&new_client->dev, &dev_attr_in1_min);	device_create_file(&new_client->dev, &dev_attr_in2_min);	device_create_file(&new_client->dev, &dev_attr_in3_min);	device_create_file(&new_client->dev, &dev_attr_in4_min);	device_create_file(&new_client->dev, &dev_attr_in5_min);	device_create_file(&new_client->dev, &dev_attr_in6_min);	device_create_file(&new_client->dev, &dev_attr_in0_max);	device_create_file(&new_client->dev, &dev_attr_in1_max);	device_create_file(&new_client->dev, &dev_attr_in2_max);	device_create_file(&new_client->dev, &dev_attr_in3_max);	device_create_file(&new_client->dev, &dev_attr_in4_max);	device_create_file(&new_client->dev, &dev_attr_in5_max);	device_create_file(&new_client->dev, &dev_attr_in6_max);	device_create_file(&new_client->dev, &dev_attr_in0_input);	device_create_file(&new_client->dev, &dev_attr_in1_input);	device_create_file(&new_client->dev, &dev_attr_in2_input);	device_create_file(&new_client->dev, &dev_attr_in3_input);	device_create_file(&new_client->dev, &dev_attr_in4_input);	device_create_file(&new_client->dev, &dev_attr_in5_input);	device_create_file(&new_client->dev, &dev_attr_in6_input);	device_create_file(&new_client->dev, &dev_attr_fan1_min);	device_create_file(&new_client->dev, &dev_attr_fan2_min);	device_create_file(&new_client->dev, &dev_attr_fan1_input);	device_create_file(&new_client->dev, &dev_attr_fan2_input);	device_create_file(&new_client->dev, &dev_attr_fan1_div);	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_max_hyst);	device_create_file(&new_client->dev, &dev_attr_temp1_crit);	device_create_file(&new_client->dev, &dev_attr_temp1_crit_hyst);	device_create_file(&new_client->dev, &dev_attr_alarms);	return 0;error_detach:	i2c_detach_client(new_client);error_free:	kfree(data);exit:	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ba9c2e8d15da029ea3051c95e446b2d638ef02e2/lm80.c/buggy/drivers/hwmon/lm80.c