Skip to contentSkip to conversation

USB: Check no positive return values from pm_runtime_resume_and_get()

PATCH Superseded Sakari Ailus 2 participants 6 messages Aug 11, 2025 – Aug 15, 2025 USB

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: Check no positive return values from pm_runtime_resume_and_get()

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")
---
 drivers/usb/core/driver.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/usb/core/driver.c +0 -4
index 460d4dde5994..21a732e052cf 100644
@@ -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);
Signature · 1 line
2.39.5
#1 lore raw
Quoted 6 lines · Sakari Ailus

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")

If there is no need for this check, why does this need to be backported to stable kernels?

confused,

greg k-h

#2 lore raw

Hi Greg,

Quoted 10 lines · Greg Kroah-Hartman
Quoted 6 lines · Sakari Ailus

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")

If there is no need for this check, why does this need to be backported to stable kernels?

It's not necessary IMO.

The practice lately has been to add Cc: stable if the Fixes: tag is there. But there was no actual bug in this case, just that this change ideally would have been part of the original patch.

Signature · 3 lines
Regards,

Sakari Ailus
#3 lore raw
Quoted 11 lines · Sakari Ailus

Hi Greg,

Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Sakari Ailus

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")
Quoted 6 lines
Quoted 2 lines

If there is no need for this check, why does this need to be backported to stable kernels?

It's not necessary IMO.

The practice lately has been to add Cc: stable if the Fixes: tag is there.

If it actually fixes a bug.

Quoted 2 lines

But there was no actual bug in this case, just that this change ideally would have been part of the original patch.

Then it's not really a "fix" so that tag does not need to be there either :)

thanks,

greg k-h

#4 lore raw
Quoted 19 lines · Greg Kroah-Hartman
Quoted 11 lines · Sakari Ailus

Hi Greg,

Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Sakari Ailus

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")
Quoted 6 lines
Quoted 2 lines

If there is no need for this check, why does this need to be backported to stable kernels?

It's not necessary IMO.

The practice lately has been to add Cc: stable if the Fixes: tag is there.

Quoted 7 lines

If it actually fixes a bug.

Quoted 2 lines

But there was no actual bug in this case, just that this change ideally would have been part of the original patch.

Then it's not really a "fix" so that tag does not need to be there either :)

I agree, both should be removed. Can you drop them or should I send v2?

Signature · 1 line
Sakari Ailus
#5 lore raw
Quoted 22 lines · Sakari Ailus
Quoted 21 lines · Greg Kroah-Hartman
Quoted 11 lines · Sakari Ailus

Hi Greg,

Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Sakari Ailus

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")
Quoted 6 lines
Quoted 2 lines

If there is no need for this check, why does this need to be backported to stable kernels?

It's not necessary IMO.

The practice lately has been to add Cc: stable if the Fixes: tag is there.

If it actually fixes a bug.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

But there was no actual bug in this case, just that this change ideally would have been part of the original patch.

Then it's not really a "fix" so that tag does not need to be there either :)

I agree, both should be removed. Can you drop them or should I send v2?

Please send a v2.

thanks,

greg k-h