if (!(data = kmalloc(sizeof(struct asb100_data), GFP_KERNEL))) { pr_debug("asb100.o: detect failed, kmalloc failed!\n"); 
if (!(data = kzalloc(sizeof(struct asb100_data), GFP_KERNEL))) { pr_debug("asb100.o: detect failed, kzalloc failed!\n"); 
static int asb100_detect(struct i2c_adapter *adapter, int address, int kind){	int err;	struct i2c_client *new_client;	struct asb100_data *data;	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {		pr_debug("asb100.o: detect failed, "				"smbus byte data not supported!\n");		err = -ENODEV;		goto ERROR0;	}	/* 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 asb100_{read,write}_value. */	if (!(data = kmalloc(sizeof(struct asb100_data), GFP_KERNEL))) {		pr_debug("asb100.o: detect failed, kmalloc failed!\n");		err = -ENOMEM;		goto ERROR0;	}	memset(data, 0, sizeof(struct asb100_data));	new_client = &data->client;	init_MUTEX(&data->lock);	i2c_set_clientdata(new_client, data);	new_client->addr = address;	new_client->adapter = adapter;	new_client->driver = &asb100_driver;	new_client->flags = 0;	/* Now, we do the remaining detection. */	/* The chip may be stuck in some other bank than bank 0. This may	   make reading other information impossible. Specify a force=... or	   force_*=... parameter, and the chip will be reset to the right	   bank. */	if (kind < 0) {		int val1 = asb100_read_value(new_client, ASB100_REG_BANK);		int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN);		/* If we're in bank 0 */		if ( (!(val1 & 0x07)) &&				/* Check for ASB100 ID (low byte) */				( ((!(val1 & 0x80)) && (val2 != 0x94)) ||				/* Check for ASB100 ID (high byte ) */				((val1 & 0x80) && (val2 != 0x06)) ) ) {			pr_debug("asb100.o: detect failed, "					"bad chip id 0x%02x!\n", val2);			err = -ENODEV;			goto ERROR1;		}	} /* kind < 0 */	/* We have either had a force parameter, or we have already detected	   Winbond. Put it now into bank 0 and Vendor ID High Byte */	asb100_write_value(new_client, ASB100_REG_BANK,		(asb100_read_value(new_client, ASB100_REG_BANK) & 0x78) | 0x80);	/* Determine the chip type. */	if (kind <= 0) {		int val1 = asb100_read_value(new_client, ASB100_REG_WCHIPID);		int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN);		if ((val1 == 0x31) && (val2 == 0x06))			kind = asb100;		else {			if (kind == 0)				dev_warn(&new_client->dev, "ignoring "					"'force' parameter for unknown chip "					"at adapter %d, address 0x%02x.\n",					i2c_adapter_id(adapter), address);			err = -ENODEV;			goto ERROR1;		}	}	/* Fill in remaining client fields and put it into the global list */	strlcpy(new_client->name, "asb100", I2C_NAME_SIZE);	data->type = kind;	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 ERROR1;	/* Attach secondary lm75 clients */	if ((err = asb100_detect_subclients(adapter, address, kind,			new_client)))		goto ERROR2;	/* Initialize the chip */	asb100_init_client(new_client);	/* A few vars need to be filled upon startup */	data->fan_min[0] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(0));	data->fan_min[1] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(1));	data->fan_min[2] = asb100_read_value(new_client, ASB100_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 ERROR3;	}	device_create_file_in(new_client, 0);	device_create_file_in(new_client, 1);	device_create_file_in(new_client, 2);	device_create_file_in(new_client, 3);	device_create_file_in(new_client, 4);	device_create_file_in(new_client, 5);	device_create_file_in(new_client, 6);	device_create_file_fan(new_client, 1);	device_create_file_fan(new_client, 2);	device_create_file_fan(new_client, 3);	device_create_file_temp(new_client, 1);	device_create_file_temp(new_client, 2);	device_create_file_temp(new_client, 3);	device_create_file_temp(new_client, 4);	device_create_file_vid(new_client);	device_create_file_vrm(new_client);	device_create_file_alarms(new_client);	device_create_file_pwm1(new_client);	return 0;ERROR3:	i2c_detach_client(data->lm75[1]);	i2c_detach_client(data->lm75[0]);	kfree(data->lm75[1]);	kfree(data->lm75[0]);ERROR2:	i2c_detach_client(new_client);ERROR1:	kfree(data);ERROR0:	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ba9c2e8d15da029ea3051c95e446b2d638ef02e2/asb100.c/clean/drivers/hwmon/asb100.c