From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-la0-f53.google.com ([209.85.215.53]:49285 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753815Ab3KOLkv (ORCPT ); Fri, 15 Nov 2013 06:40:51 -0500 Received: by mail-la0-f53.google.com with SMTP id ea20so2621785lab.26 for ; Fri, 15 Nov 2013 03:40:50 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, Ulf Hansson , Kevin Hilman , Alan Stern Subject: [PATCH 1/2] PM / Runtime: Fix error path for prepare Date: Fri, 15 Nov 2013 12:40:44 +0100 Message-Id: <1384515645-8696-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-pci-owner@vger.kernel.org List-ID: If a device prepare callback for some reason would fail, the PM core prevented the device from going inactive forever. In this case, to reverse the pm_runtime_get_noresume() we invokes the asyncronous pm_runtime_put(), thus restoring the usage count. Cc: Kevin Hilman Cc: Alan Stern Signed-off-by: Ulf Hansson --- drivers/base/power/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index ee039af..2a1b06a 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1350,6 +1350,9 @@ static int device_prepare(struct device *dev, pm_message_t state) device_unlock(dev); + if (error) + pm_runtime_put(dev); + return error; } -- 1.7.9.5