diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-07-31 18:43:41 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-07-31 18:43:41 +0200 |
| commit | 85e9ca333d03fbd56b9e123c8456f0d98e20faad (patch) | |
| tree | 7bb15ada5f536950efa23ad60ea9eea60380ca1c /drivers/acpi/fan.c | |
| parent | a300bec952127d9a15e666b391bb35c9aecb3002 (diff) | |
| parent | 6e86841d05f371b5b9b86ce76c02aaee83352298 (diff) | |
| download | linux-85e9ca333d03fbd56b9e123c8456f0d98e20faad.tar.gz linux-85e9ca333d03fbd56b9e123c8456f0d98e20faad.tar.bz2 linux-85e9ca333d03fbd56b9e123c8456f0d98e20faad.zip | |
Merge branch 'linus' into timers/hpet
Diffstat (limited to 'drivers/acpi/fan.c')
| -rw-r--r-- | drivers/acpi/fan.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 6cf10cbc1eee..2655bc1b4eeb 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -148,7 +148,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, int result = 0; struct seq_file *m = file->private_data; struct acpi_device *device = m->private; - char state_string[12] = { '\0' }; + char state_string[3] = { '\0' }; if (count > sizeof(state_string) - 1) return -EINVAL; @@ -157,6 +157,12 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, return -EFAULT; state_string[count] = '\0'; + if ((state_string[0] < '0') || (state_string[0] > '3')) + return -EINVAL; + if (state_string[1] == '\n') + state_string[1] = '\0'; + if (state_string[1] != '\0') + return -EINVAL; result = acpi_bus_set_power(device->handle, simple_strtoul(state_string, NULL, 0)); @@ -257,22 +263,22 @@ static int acpi_fan_add(struct acpi_device *device) goto end; } - printk(KERN_INFO PREFIX - "%s is registered as cooling_device%d\n", - device->dev.bus_id, cdev->id); + dev_info(&device->dev, "registered as cooling_device%d\n", cdev->id); acpi_driver_data(device) = cdev; result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj, "thermal_cooling"); if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); + dev_err(&device->dev, "Failed to create sysfs link " + "'thermal_cooling'\n"); result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj, "device"); if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); + dev_err(&device->dev, "Failed to create sysfs link " + "'device'\n"); result = acpi_fan_add_fs(device); if (result) |
