diff mbox

ACPI/Power: Release resource_lock after acpi_power_get_state() return error

Message ID 1381837691-3657-1-git-send-email-tianyu.lan@intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

lan,Tianyu Oct. 15, 2013, 11:48 a.m. UTC
resource_lock should be released when acpi_power_get_state() fails and before
passing to next power resource on the acpi power resource list.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
---
 drivers/acpi/power.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Oct. 15, 2013, 9:06 p.m. UTC | #1
On Tuesday, October 15, 2013 07:48:11 PM Lan Tianyu wrote:
> resource_lock should be released when acpi_power_get_state() fails and before
> passing to next power resource on the acpi power resource list.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>

Yup, good catch!

I'll queue this up as a fix for 3.12.

Thanks!

> ---
>  drivers/acpi/power.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
> index 0dbe5cd..0c1c3ec 100644
> --- a/drivers/acpi/power.c
> +++ b/drivers/acpi/power.c
> @@ -936,8 +936,10 @@ void acpi_resume_power_resources(void)
>  		mutex_lock(&resource->resource_lock);
>  
>  		result = acpi_power_get_state(resource->device.handle, &state);
> -		if (result)
> +		if (result) {
> +			mutex_unlock(&resource->resource_lock);
>  			continue;
> +		}
>  
>  		if (state == ACPI_POWER_RESOURCE_STATE_OFF
>  		    && resource->ref_count) {
>
diff mbox

Patch

diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 0dbe5cd..0c1c3ec 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -936,8 +936,10 @@  void acpi_resume_power_resources(void)
 		mutex_lock(&resource->resource_lock);
 
 		result = acpi_power_get_state(resource->device.handle, &state);
-		if (result)
+		if (result) {
+			mutex_unlock(&resource->resource_lock);
 			continue;
+		}
 
 		if (state == ACPI_POWER_RESOURCE_STATE_OFF
 		    && resource->ref_count) {