if (!(data = kmalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) { 
if (!(data = kzalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) { 
static int smsc47m1_detect(struct i2c_adapter *adapter){	struct i2c_client *new_client;	struct smsc47m1_data *data;	int err = 0;	int fan1, fan2, pwm1, pwm2;	if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) {		dev_err(&adapter->dev, "Region 0x%x already in use!\n", address);		return -EBUSY;	}	if (!(data = kmalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) {		err = -ENOMEM;		goto error_release;	}	memset(data, 0x00, sizeof(struct smsc47m1_data));	new_client = &data->client;	i2c_set_clientdata(new_client, data);	new_client->addr = address;	init_MUTEX(&data->lock);	new_client->adapter = adapter;	new_client->driver = &smsc47m1_driver;	new_client->flags = 0;	strlcpy(new_client->name, "smsc47m1", I2C_NAME_SIZE);	init_MUTEX(&data->update_lock);	/* If no function is properly configured, there's no point in	   actually registering the chip. */	fan1 = (smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(0)) & 0x05)	       == 0x05;	fan2 = (smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(1)) & 0x05)	       == 0x05;	pwm1 = (smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(0)) & 0x05)	       == 0x04;	pwm2 = (smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(1)) & 0x05)	       == 0x04;	if (!(fan1 || fan2 || pwm1 || pwm2)) {		dev_warn(&new_client->dev, "Device is not configured, will not use\n");		err = -ENODEV;		goto error_free;	}	if ((err = i2c_attach_client(new_client)))		goto error_free;	/* Some values (fan min, clock dividers, pwm registers) may be	   needed before any update is triggered, so we better read them	   at least once here. We don't usually do it that way, but in	   this particular case, manually reading 5 registers out of 8	   doesn't make much sense and we're better using the existing	   function. */	smsc47m1_update_device(&new_client->dev, 1);	/* 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;	}	if (fan1) {		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);	} else		dev_dbg(&new_client->dev, "Fan 1 not enabled by hardware, "			"skipping\n");	if (fan2) {		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);	} else		dev_dbg(&new_client->dev, "Fan 2 not enabled by hardware, "			"skipping\n");	if (pwm1) {		device_create_file(&new_client->dev, &dev_attr_pwm1);		device_create_file(&new_client->dev, &dev_attr_pwm1_enable);	} else		dev_dbg(&new_client->dev, "PWM 1 not enabled by hardware, "			"skipping\n");	if (pwm2) {		device_create_file(&new_client->dev, &dev_attr_pwm2);		device_create_file(&new_client->dev, &dev_attr_pwm2_enable);	} else		dev_dbg(&new_client->dev, "PWM 2 not enabled by hardware, "			"skipping\n");	device_create_file(&new_client->dev, &dev_attr_alarms);	return 0;error_detach:	i2c_detach_client(new_client);error_free:	kfree(data);error_release:	release_region(address, SMSC_EXTENT);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ba9c2e8d15da029ea3051c95e446b2d638ef02e2/smsc47m1.c/buggy/drivers/hwmon/smsc47m1.c