X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmacintosh%2Ftherm_adt746x.c;h=5366dc93fb383b2d18125eda47f477b285db3a3d;hb=4b1295b0df28cffd40e6c6d7c4b88dec7af1eb76;hp=276945d515130724e2c575b0a538aa8106b2449b;hpb=70f227d8846a8a9b1f36f71c42e11cc7c6e9408d;p=linux-2.6 diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 276945d515..5366dc93fb 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c @@ -553,6 +553,7 @@ thermostat_init(void) struct device_node* np; const u32 *prop; int i = 0, offset = 0; + int err; np = of_find_node_by_name(NULL, "fan"); if (!np) @@ -561,18 +562,24 @@ thermostat_init(void) therm_type = ADT7460; else if (of_device_is_compatible(np, "adt7467")) therm_type = ADT7467; - else + else { + of_node_put(np); return -ENODEV; + } prop = of_get_property(np, "hwsensor-params-version", NULL); printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, (*prop == 1)?"":"un"); - if (*prop != 1) + if (*prop != 1) { + of_node_put(np); return -ENODEV; + } prop = of_get_property(np, "reg", NULL); - if (!prop) + if (!prop) { + of_node_put(np); return -ENODEV; + } /* look for bus either by path or using "reg" */ if (strstr(np->full_name, "/i2c-bus@") != NULL) { @@ -609,20 +616,24 @@ thermostat_init(void) if (of_dev == NULL) { printk(KERN_ERR "Can't register temperatures device !\n"); + of_node_put(np); return -ENODEV; } - device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature); - device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature); - device_create_file(&of_dev->dev, &dev_attr_sensor1_limit); - device_create_file(&of_dev->dev, &dev_attr_sensor2_limit); - device_create_file(&of_dev->dev, &dev_attr_sensor1_location); - device_create_file(&of_dev->dev, &dev_attr_sensor2_location); - device_create_file(&of_dev->dev, &dev_attr_limit_adjust); - device_create_file(&of_dev->dev, &dev_attr_specified_fan_speed); - device_create_file(&of_dev->dev, &dev_attr_sensor1_fan_speed); + err = device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_limit); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_limit); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_location); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_location); + err |= device_create_file(&of_dev->dev, &dev_attr_limit_adjust); + err |= device_create_file(&of_dev->dev, &dev_attr_specified_fan_speed); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_fan_speed); if(therm_type == ADT7460) - device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); + if (err) + printk(KERN_WARNING + "Failed to create tempertaure attribute file(s).\n"); #ifndef CONFIG_I2C_POWERMAC request_module("i2c-powermac");