memset(data, 0, sizeof(struct lm75_data)); 
static int lm75_detect(struct i2c_adapter *adapter, int address, int kind){	int i;	struct i2c_client *new_client;	struct lm75_data *data;	int err = 0;	const char *name = "";	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |				     I2C_FUNC_SMBUS_WORD_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 lm75_{read,write}_value. */	if (!(data = kmalloc(sizeof(struct lm75_data), GFP_KERNEL))) {		err = -ENOMEM;		goto exit;	}	memset(data, 0, sizeof(struct lm75_data));	new_client = &data->client;	i2c_set_clientdata(new_client, data);	new_client->addr = address;	new_client->adapter = adapter;	new_client->driver = &lm75_driver;	new_client->flags = 0;	/* Now, we do the remaining detection. There is no identification-	   dedicated register so we have to rely on several tricks:	   unused bits, registers cycling over 8-address boundaries,	   addresses 0x04-0x07 returning the last read value.	   The cycling+unused addresses combination is not tested,	   since it would significantly slow the detection down and would	   hardly add any value. */	if (kind < 0) {		int cur, conf, hyst, os;		/* Unused addresses */		cur = i2c_smbus_read_word_data(new_client, 0);		conf = i2c_smbus_read_byte_data(new_client, 1);		hyst = i2c_smbus_read_word_data(new_client, 2);		if (i2c_smbus_read_word_data(new_client, 4) != hyst		 || i2c_smbus_read_word_data(new_client, 5) != hyst		 || i2c_smbus_read_word_data(new_client, 6) != hyst		 || i2c_smbus_read_word_data(new_client, 7) != hyst)		 	goto exit_free;		os = i2c_smbus_read_word_data(new_client, 3);		if (i2c_smbus_read_word_data(new_client, 4) != os		 || i2c_smbus_read_word_data(new_client, 5) != os		 || i2c_smbus_read_word_data(new_client, 6) != os		 || i2c_smbus_read_word_data(new_client, 7) != os)		 	goto exit_free;		/* Unused bits */		if (conf & 0xe0)		 	goto exit_free;		/* Addresses cycling */		for (i = 8; i < 0xff; i += 8)			if (i2c_smbus_read_byte_data(new_client, i + 1) != conf			 || i2c_smbus_read_word_data(new_client, i + 2) != hyst			 || i2c_smbus_read_word_data(new_client, i + 3) != os)				goto exit_free;	}	/* Determine the chip type - only one kind supported! */	if (kind <= 0)		kind = lm75;	if (kind == lm75) {		name = "lm75";	}	/* 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 exit_free;	/* Initialize the LM75 chip */	lm75_init_client(new_client);		/* 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 exit_detach;	}	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_input);	return 0;exit_detach:	i2c_detach_client(new_client);exit_free:	kfree(data);exit:	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ba9c2e8d15da029ea3051c95e446b2d638ef02e2/lm75.c/clean/drivers/hwmon/lm75.c