From patchwork Tue Jul 15 17:01:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sam-the-6 X-Patchwork-Id: 33679 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 60F74201F1 for ; Tue, 15 Jul 2014 17:09:32 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id tr6sf33177366ieb.2 for ; Tue, 15 Jul 2014 10:09:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=a07DQIQz7plj2lOyeQ6CRl1ZsvWHBd5CxrAP2GoLjZA=; b=i/xkCql32Jdw9pYOP8H1g60gsca9uU+M8N9IMc0Elb6wIX8uLOPChmJLQkYEEyIiGt /6RxA+2xEa14d0UyOxU9GQHplT+xmlZJbPDWSV4/lWwSP2RJEA04ddBlneKM5rBElZ0C eA0PdauyRvwPYW/AC/N1ezFXLm30hvbdXeDaqYHOK6f05eIkaYPJ5CG1Hu3GR8uapNRX J7qbWKNUOShhdkJgjHC/XS5LV7jD5dLxgZqrKNAtUPar1FjW3b/7A8cwcFzBtbTOG8Zh UyEFEHMKJReG4L631Re6/cfncRXOkArs1Yws/+3N2Fj9wb6vdvdNaa/B3zu8w+EGfEJN cKbQ== X-Gm-Message-State: ALoCoQkXotTVW0YDRpLseMtNOe5M/9bb4+oRv6KEShDQQQzh0s6e5xFG880e85zFeKe1aQAoJzHU X-Received: by 10.182.115.133 with SMTP id jo5mr12152156obb.38.1405444171894; Tue, 15 Jul 2014 10:09:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.231 with SMTP id z94ls153644qgz.63.gmail; Tue, 15 Jul 2014 10:09:31 -0700 (PDT) X-Received: by 10.58.30.15 with SMTP id o15mr2935598veh.34.1405444171788; Tue, 15 Jul 2014 10:09:31 -0700 (PDT) Received: from mail-vc0-x235.google.com (mail-vc0-x235.google.com [2607:f8b0:400c:c03::235]) by mx.google.com with ESMTPS id ju5si7066871veb.53.2014.07.15.10.09.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jul 2014 10:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::235 as permitted sender) client-ip=2607:f8b0:400c:c03::235; Received: by mail-vc0-f181.google.com with SMTP id lf12so6890952vcb.40 for ; Tue, 15 Jul 2014 10:09:31 -0700 (PDT) X-Received: by 10.52.244.81 with SMTP id xe17mr19732295vdc.24.1405444171692; Tue, 15 Jul 2014 10:09:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp230997vcb; Tue, 15 Jul 2014 10:09:31 -0700 (PDT) X-Received: by 10.70.35.169 with SMTP id i9mr13531605pdj.36.1405444168375; Tue, 15 Jul 2014 10:09:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ak7si12262710pad.1.2014.07.15.10.09.27; Tue, 15 Jul 2014 10:09:27 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757413AbaGORIz (ORCPT + 28 others); Tue, 15 Jul 2014 13:08:55 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:37012 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755909AbaGORCT (ORCPT ); Tue, 15 Jul 2014 13:02:19 -0400 Received: by mail-wi0-f182.google.com with SMTP id d1so4672830wiv.15 for ; Tue, 15 Jul 2014 10:02:18 -0700 (PDT) X-Received: by 10.194.250.37 with SMTP id yz5mr28108815wjc.47.1405443738357; Tue, 15 Jul 2014 10:02:18 -0700 (PDT) Received: from Debian ([94.54.73.8]) by mx.google.com with ESMTPSA id ja9sm45823229wic.8.2014.07.15.10.02.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 15 Jul 2014 10:02:17 -0700 (PDT) Received: from sam by Debian with local (Exim 4.80) (envelope-from ) id 1X767J-000454-9E; Tue, 15 Jul 2014 20:02:13 +0300 From: Sam Asadi To: gregkh@linuxfoundation.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Roger Quadros , Kishon Vijay Abraham I , sam-the-6 Subject: [PATCH 75/94] phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove Date: Tue, 15 Jul 2014 20:01:30 +0300 Message-Id: <1405443709-15288-75-git-send-email-asadi.samuel@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1405443709-15288-1-git-send-email-asadi.samuel@gmail.com> References: <1405443709-15288-1-git-send-email-asadi.samuel@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: asadi.samuel@gmail.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::235 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Roger Quadros If probe fails then we need to call pm_runtime_disable() to balance out the previous pm_runtime_enable() call. Else it will cause unbalanced pm_runtime_enable() call in the succeding probe call. This anomaly was observed when the call to devm_phy_create() failed with -EPROBE_DEFER. Balance out the pm_runtime_enable() call in .remove() as well. Signed-off-by: Roger Quadros Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Greg Kroah-Hartman Signed-off-by: sam-the-6 --- drivers/phy/phy-omap-usb2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 2063d54..34b3961 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -262,7 +262,6 @@ static int omap_usb2_probe(struct platform_device *pdev) otg->phy = &phy->phy; platform_set_drvdata(pdev, phy); - pm_runtime_enable(phy->dev); generic_phy = devm_phy_create(phy->dev, &ops, NULL); if (IS_ERR(generic_phy)) @@ -270,10 +269,13 @@ static int omap_usb2_probe(struct platform_device *pdev) phy_set_drvdata(generic_phy, phy); + pm_runtime_enable(phy->dev); phy_provider = devm_of_phy_provider_register(phy->dev, of_phy_simple_xlate); - if (IS_ERR(phy_provider)) + if (IS_ERR(phy_provider)) { + pm_runtime_disable(phy->dev); return PTR_ERR(phy_provider); + } phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); if (IS_ERR(phy->wkupclk)) { @@ -317,6 +319,7 @@ static int omap_usb2_remove(struct platform_device *pdev) if (!IS_ERR(phy->optclk)) clk_unprepare(phy->optclk); usb_remove_phy(&phy->phy); + pm_runtime_disable(phy->dev); return 0; }