usb: dwc3: pci: Fix pm_runtime_get_sync() error checking

[ 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: 8eed00b237 ("usb: dwc3: pci: Runtime resume child device from wq")
Signed-off-by: Zheng Yongjun <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
Zheng Yongjun 2022-04-22 06:26:52 +00:00 • committed by Greg Kroah-Hartman
commit 8ad7b3d9f8

View file

@ -211,7 +211,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;
}