Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609026 > unrolled thread

[PATCH 1/7] usb: dwc3: core: fix dwc3_probe() to not do put_sync when get_sync fails

Started byShuah Khan <shuahkh@osg.samsung.com>
First post2017-03-25 01:10 +0100
Last post2017-03-25 09:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/7] usb: dwc3: core: fix dwc3_probe() to not do put_sync when get_sync fails Shuah Khan <shuahkh@osg.samsung.com> - 2017-03-25 01:10 +0100
    Re: [PATCH 1/7] usb: dwc3: core: fix dwc3_probe() to not do put_sync when get_sync fails Felipe Balbi <balbi@kernel.org> - 2017-03-25 09:00 +0100

#1609026 — [PATCH 1/7] usb: dwc3: core: fix dwc3_probe() to not do put_sync when get_sync fails

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-03-25 01:10 +0100
Subject[PATCH 1/7] usb: dwc3: core: fix dwc3_probe() to not do put_sync when get_sync fails
Message-ID<toHrj-ZP-1@gated-at.bofh.it>
dwc3_probe() does pm_runtime_put_sync() in its err1 handling when
pm_runtime_get_sync() fails.  Move the pm_runtime_put_sync() under
err2 instead as it is used in error paths after pm_runtime_get_sync()
succeeds.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/usb/dwc3/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 56f1367..0fc7bef 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1162,9 +1162,9 @@ static int dwc3_probe(struct platform_device *pdev)
 
 err2:
 	pm_runtime_allow(&pdev->dev);
+	pm_runtime_put_sync(&pdev->dev);
 
 err1:
-	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 err0:
-- 
2.7.4

[toc] | [next] | [standalone]


#1609117

FromFelipe Balbi <balbi@kernel.org>
Date2017-03-25 09:00 +0100
Message-ID<toOMb-67F-19@gated-at.bofh.it>
In reply to#1609026
Hi,

Shuah Khan <shuahkh@osg.samsung.com> writes:
> dwc3_probe() does pm_runtime_put_sync() in its err1 handling when
> pm_runtime_get_sync() fails.  Move the pm_runtime_put_sync() under
> err2 instead as it is used in error paths after pm_runtime_get_sync()
> succeeds.

there's nothing wrong with current code. Read the docs. Even if
pm_runtime_get*() fails, you still need to decrement the usage
counter. pm_runtime_put*() is one way of achieving so.

-- 
balbi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web