ACPI / PM: Do not refcount power resources that can't be turned on
authorRafael J. Wysocki <rjw@sisk.pl>
Wed, 24 Nov 2010 23:03:32 +0000 (00:03 +0100)
committerLen Brown <len.brown@intel.com>
Wed, 1 Dec 2010 21:53:39 +0000 (16:53 -0500)
If turning on a power resource fails, do not reference count it,
since it cannot be in use in that case.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/power.c

index 792a8309d074a178303eb4c3d467c68a382c760b..4c9c2fb5d98f9a14a67e8618b44dc6f2c642887b 100644 (file)
@@ -213,11 +213,13 @@ static int acpi_power_on(acpi_handle handle)
                                  resource->name));
        } else {
                result = __acpi_power_on(resource);
+               if (result)
+                       resource->ref_count--;
        }
 
        mutex_unlock(&resource->resource_lock);
 
-       return 0;
+       return result;
 }
 
 static int acpi_power_off_device(acpi_handle handle)