]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: dwc3: pci: Fix pm_runtime_get_sync() error checking
authorZheng Yongjun <zhengyongjun3@huawei.com>
Fri, 22 Apr 2022 06:26:52 +0000 (06:26 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:44:47 +0000 (18:44 +0200)
[ Upstream commit a03e2ddab8e735e2cc315609b297b300e9cc60d2 ]

If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.

Fixes: 8eed00b237a28 ("usb: dwc3: pci: Runtime resume child device from wq")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20220422062652.10575-1-zhengyongjun3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/dwc3/dwc3-pci.c

index 2e19e0e4ea538fcc3d759f1c27a01b6fd35c4564..ba51de7dd7605cf725119ec0ff6abfa434510cc3 100644 (file)
@@ -288,7 +288,7 @@ static void dwc3_pci_resume_work(struct work_struct *work)
        int ret;
 
        ret = pm_runtime_get_sync(&dwc3->dev);
-       if (ret) {
+       if (ret < 0) {
                pm_runtime_put_sync_autosuspend(&dwc3->dev);
                return;
        }