Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>

authored by

Zheng Yongjun and committed by
Greg Kroah-Hartman
a03e2dda 4d378f2a

+1 -1
+1 -1
drivers/usb/dwc3/dwc3-pci.c
··· 286 286 int ret; 287 287 288 288 ret = pm_runtime_get_sync(&dwc3->dev); 289 - if (ret) { 289 + if (ret < 0) { 290 290 pm_runtime_put_sync_autosuspend(&dwc3->dev); 291 291 return; 292 292 }