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

* Re: [PATCH 1/1] USB: Check no positive return values from pm_runtime_resume_and_get()
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2025-08-13 14:43 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-usb, Zijun Hu, Oliver Neukum, Alan Stern

On Mon, Aug 11, 2025 at 09:24:03AM +0300, Sakari Ailus wrote:
> 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

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

confused,

greg k-h

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

* Re: [PATCH 1/1] USB: Check no positive return values from pm_runtime_resume_and_get()
  2025-08-13 14:43 ` Greg Kroah-Hartman
@ 2025-08-15  9:34   ` Sakari Ailus
  2025-08-15  9:38     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Sakari Ailus @ 2025-08-15  9:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Zijun Hu, Oliver Neukum, Alan Stern

Hi Greg,

On Wed, Aug 13, 2025 at 04:43:05PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Aug 11, 2025 at 09:24:03AM +0300, Sakari Ailus wrote:
> > 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
> 
> 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.

-- 
Regards,

Sakari Ailus

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

* Re: [PATCH 1/1] USB: Check no positive return values from pm_runtime_resume_and_get()
  2025-08-15  9:34   ` Sakari Ailus
@ 2025-08-15  9:38     ` Greg Kroah-Hartman
  2025-08-15 10:06       ` Sakari Ailus
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2025-08-15  9:38 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-usb, Zijun Hu, Oliver Neukum, Alan Stern

On Fri, Aug 15, 2025 at 09:34:00AM +0000, Sakari Ailus wrote:
> Hi Greg,
> 
> On Wed, Aug 13, 2025 at 04:43:05PM +0200, Greg Kroah-Hartman wrote:
> > On Mon, Aug 11, 2025 at 09:24:03AM +0300, Sakari Ailus wrote:
> > > 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
> > 
> > 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.

> 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

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

* Re: [PATCH 1/1] USB: Check no positive return values from pm_runtime_resume_and_get()
  2025-08-15  9:38     ` Greg Kroah-Hartman
@ 2025-08-15 10:06       ` Sakari Ailus
  2025-08-15 10:14         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Sakari Ailus @ 2025-08-15 10:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Zijun Hu, Oliver Neukum, Alan Stern

On Fri, Aug 15, 2025 at 11:38:28AM +0200, Greg Kroah-Hartman wrote:
> On Fri, Aug 15, 2025 at 09:34:00AM +0000, Sakari Ailus wrote:
> > Hi Greg,
> > 
> > On Wed, Aug 13, 2025 at 04:43:05PM +0200, Greg Kroah-Hartman wrote:
> > > On Mon, Aug 11, 2025 at 09:24:03AM +0300, Sakari Ailus wrote:
> > > > 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
> > > 
> > > 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.
> 
> > 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?

-- 
Sakari Ailus

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

* Re: [PATCH 1/1] USB: Check no positive return values from pm_runtime_resume_and_get()
  2025-08-15 10:06       ` Sakari Ailus
@ 2025-08-15 10:14         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2025-08-15 10:14 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-usb, Zijun Hu, Oliver Neukum, Alan Stern

On Fri, Aug 15, 2025 at 10:06:13AM +0000, Sakari Ailus wrote:
> On Fri, Aug 15, 2025 at 11:38:28AM +0200, Greg Kroah-Hartman wrote:
> > On Fri, Aug 15, 2025 at 09:34:00AM +0000, Sakari Ailus wrote:
> > > Hi Greg,
> > > 
> > > On Wed, Aug 13, 2025 at 04:43:05PM +0200, Greg Kroah-Hartman wrote:
> > > > On Mon, Aug 11, 2025 at 09:24:03AM +0300, Sakari Ailus wrote:
> > > > > 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
> > > > 
> > > > 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.
> > 
> > > 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

^ permalink raw reply	[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).