linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] USB: Check no positive return values from pm_runtime_resume_and_get()
@ 2025-08-11  6:24 Sakari Ailus
  2025-08-13 14:43 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Sakari Ailus @ 2025-08-11  6:24 UTC (permalink / raw)
  To: linux-usb; +Cc: Greg Kroah-Hartman, Zijun Hu, Oliver Neukum, Alan Stern

pm_runtime_resume_and_get() always returns a negative error code or zero;
there's no need to check for positive values such as returned by
pm_runtime_get_sync(). Simply drop the check.

Fixes: 7626c52b6b46 ("usb: usb_autopm_get_interface use modern helper")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/usb/core/driver.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 460d4dde5994..21a732e052cf 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1723,8 +1723,6 @@ int usb_autoresume_device(struct usb_device *udev)
 	dev_vdbg(&udev->dev, "%s: cnt %d -> %d\n",
 			__func__, atomic_read(&udev->dev.power.usage_count),
 			status);
-	if (status > 0)
-		status = 0;
 	return status;
 }
 
@@ -1829,8 +1827,6 @@ int usb_autopm_get_interface(struct usb_interface *intf)
 	dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n",
 			__func__, atomic_read(&intf->dev.power.usage_count),
 			status);
-	if (status > 0)
-		status = 0;
 	return status;
 }
 EXPORT_SYMBOL_GPL(usb_autopm_get_interface);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-15 10:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11  6:24 [PATCH 1/1] USB: Check no positive return values from pm_runtime_resume_and_get() Sakari Ailus
2025-08-13 14:43 ` Greg Kroah-Hartman
2025-08-15  9:34   ` Sakari Ailus
2025-08-15  9:38     ` Greg Kroah-Hartman
2025-08-15 10:06       ` Sakari Ailus
2025-08-15 10:14         ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).