if (!(data = kmalloc(sizeof(struct lm85_data), GFP_KERNEL))) { 
if (!(data = kzalloc(sizeof(struct lm85_data), GFP_KERNEL))) { 
int lm85_detect(struct i2c_adapter *adapter, int address,		int kind){	int company, verstep ;	struct i2c_client *new_client = NULL;	struct lm85_data *data;	int err = 0;	const char *type_name = "";	if (!i2c_check_functionality(adapter,					I2C_FUNC_SMBUS_BYTE_DATA)) {		/* We need to be able to do byte I/O */		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 lm85_{read,write}_value. */	if (!(data = kmalloc(sizeof(struct lm85_data), GFP_KERNEL))) {		err = -ENOMEM;		goto ERROR0;	}	memset(data, 0, sizeof(struct lm85_data));	new_client = &data->client;	i2c_set_clientdata(new_client, data);	new_client->addr = address;	new_client->adapter = adapter;	new_client->driver = &lm85_driver;	new_client->flags = 0;	/* Now, we do the remaining detection. */	company = lm85_read_value(new_client, LM85_REG_COMPANY);	verstep = lm85_read_value(new_client, LM85_REG_VERSTEP);	dev_dbg(&adapter->dev, "Detecting device at %d,0x%02x with"		" COMPANY: 0x%02x and VERSTEP: 0x%02x\n",		i2c_adapter_id(new_client->adapter), new_client->addr,		company, verstep);	/* If auto-detecting, Determine the chip type. */	if (kind <= 0) {		dev_dbg(&adapter->dev, "Autodetecting device at %d,0x%02x ...\n",			i2c_adapter_id(adapter), address );		if( company == LM85_COMPANY_NATIONAL		    && verstep == LM85_VERSTEP_LM85C ) {			kind = lm85c ;		} else if( company == LM85_COMPANY_NATIONAL		    && verstep == LM85_VERSTEP_LM85B ) {			kind = lm85b ;		} else if( company == LM85_COMPANY_NATIONAL		    && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC ) {			dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x"				" Defaulting to LM85.\n", verstep);			kind = any_chip ;		} else if( company == LM85_COMPANY_ANALOG_DEV		    && verstep == LM85_VERSTEP_ADM1027 ) {			kind = adm1027 ;		} else if( company == LM85_COMPANY_ANALOG_DEV		    && (verstep == LM85_VERSTEP_ADT7463			 || verstep == LM85_VERSTEP_ADT7463C) ) {			kind = adt7463 ;		} else if( company == LM85_COMPANY_ANALOG_DEV		    && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC ) {			dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x"				" Defaulting to Generic LM85.\n", verstep );			kind = any_chip ;		} else if( company == LM85_COMPANY_SMSC		    && (verstep == LM85_VERSTEP_EMC6D100_A0			 || verstep == LM85_VERSTEP_EMC6D100_A1) ) {			/* Unfortunately, we can't tell a '100 from a '101			 * from the registers.  Since a '101 is a '100			 * in a package with fewer pins and therefore no			 * 3.3V, 1.5V or 1.8V inputs, perhaps if those			 * inputs read 0, then it's a '101.			 */			kind = emc6d100 ;		} else if( company == LM85_COMPANY_SMSC		    && verstep == LM85_VERSTEP_EMC6D102) {			kind = emc6d102 ;		} else if( company == LM85_COMPANY_SMSC		    && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {			dev_err(&adapter->dev, "lm85: Detected SMSC chip\n");			dev_err(&adapter->dev, "lm85: Unrecognized version/stepping 0x%02x"			    " Defaulting to Generic LM85.\n", verstep );			kind = any_chip ;		} else if( kind == any_chip		    && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {			dev_err(&adapter->dev, "Generic LM85 Version 6 detected\n");			/* Leave kind as "any_chip" */		} else {			dev_dbg(&adapter->dev, "Autodetection failed\n");			/* Not an LM85 ... */			if( kind == any_chip ) {  /* User used force=x,y */				dev_err(&adapter->dev, "Generic LM85 Version 6 not"					" found at %d,0x%02x. Try force_lm85c.\n",					i2c_adapter_id(adapter), address );			}			err = 0 ;			goto ERROR1;		}	}	/* Fill in the chip specific driver values */	if ( kind == any_chip ) {		type_name = "lm85";	} else if ( kind == lm85b ) {		type_name = "lm85b";	} else if ( kind == lm85c ) {		type_name = "lm85c";	} else if ( kind == adm1027 ) {		type_name = "adm1027";	} else if ( kind == adt7463 ) {		type_name = "adt7463";	} else if ( kind == emc6d100){		type_name = "emc6d100";	} else if ( kind == emc6d102 ) {		type_name = "emc6d102";	}	strlcpy(new_client->name, type_name, I2C_NAME_SIZE);	/* Fill in the remaining client fields */	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;	/* Set the VRM version */	data->vrm = vid_which_vrm();	/* Initialize the LM85 chip */	lm85_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 ERROR2;	}	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_fan3_input);	device_create_file(&new_client->dev, &dev_attr_fan4_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_fan3_min);	device_create_file(&new_client->dev, &dev_attr_fan4_min);	device_create_file(&new_client->dev, &dev_attr_pwm1);	device_create_file(&new_client->dev, &dev_attr_pwm2);	device_create_file(&new_client->dev, &dev_attr_pwm3);	device_create_file(&new_client->dev, &dev_attr_pwm1_enable);	device_create_file(&new_client->dev, &dev_attr_pwm2_enable);	device_create_file(&new_client->dev, &dev_attr_pwm3_enable);	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_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_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_temp1_input);	device_create_file(&new_client->dev, &dev_attr_temp2_input);	device_create_file(&new_client->dev, &dev_attr_temp3_input);	device_create_file(&new_client->dev, &dev_attr_temp1_min);	device_create_file(&new_client->dev, &dev_attr_temp2_min);	device_create_file(&new_client->dev, &dev_attr_temp3_min);	device_create_file(&new_client->dev, &dev_attr_temp1_max);	device_create_file(&new_client->dev, &dev_attr_temp2_max);	device_create_file(&new_client->dev, &dev_attr_temp3_max);	device_create_file(&new_client->dev, &dev_attr_vrm);	device_create_file(&new_client->dev, &dev_attr_cpu0_vid);	device_create_file(&new_client->dev, &dev_attr_alarms);	device_create_file(&new_client->dev, &dev_attr_pwm1_auto_channels);	device_create_file(&new_client->dev, &dev_attr_pwm2_auto_channels);	device_create_file(&new_client->dev, &dev_attr_pwm3_auto_channels);	device_create_file(&new_client->dev, &dev_attr_pwm1_auto_pwm_min);	device_create_file(&new_client->dev, &dev_attr_pwm2_auto_pwm_min);	device_create_file(&new_client->dev, &dev_attr_pwm3_auto_pwm_min);	device_create_file(&new_client->dev, &dev_attr_pwm1_auto_pwm_minctl);	device_create_file(&new_client->dev, &dev_attr_pwm2_auto_pwm_minctl);	device_create_file(&new_client->dev, &dev_attr_pwm3_auto_pwm_minctl);	device_create_file(&new_client->dev, &dev_attr_pwm1_auto_pwm_freq);	device_create_file(&new_client->dev, &dev_attr_pwm2_auto_pwm_freq);	device_create_file(&new_client->dev, &dev_attr_pwm3_auto_pwm_freq);	device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_off);	device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_off);	device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_off);	device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_min);	device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_min);	device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_min);	device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_max);	device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_max);	device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_max);	device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_crit);	device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_crit);	device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_crit);	return 0;	/* Error out and cleanup code */    ERROR2:	i2c_detach_client(new_client);    ERROR1:	kfree(data);    ERROR0:	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ba9c2e8d15da029ea3051c95e446b2d638ef02e2/lm85.c/clean/drivers/hwmon/lm85.c