mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: Peter Chen <peter.chen@kernel.org>,
	Pawel Laszczak <pawell@cadence.com>,
	Roger Quadros <rogerq@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/6] usb: core: add missing pm_runtime_dont_use_autosuspend() call
Date: Wed, 16 Sep 2026 10:08:52 +0200	[thread overview]
Message-ID: <aqpOlKtxeROh-G_s@hovoldconsulting.com> (raw)
In-Reply-To: <20260915090223.1346-2-joshua.crofts1@gmail.com>

On Tue, Sep 15, 2026 at 09:02:18AM +0000, Joshua Crofts wrote:
> The fail label in usb_new_device() disables pm_runtime on failure, but
> doesn't call pm_runtime_dont_use_autosuspend(), causing resource leaks.

No it does not, as the device itself is about to be freed. Sure we could
disable autosuspend again here, but it does not really matter.

You could consider balancing the runtime pm count as well, as I guess
both of these could trip up static checkers (cf. [1]).

> Add the missing pm_runtime_dont_use_autosuspend() call.
> 
> Found using Coccinelle.
> 
> Fixes: fcc4a01eb866 ("USB: use the runtime-PM autosuspend implementation")
> Cc: <stable@vger.kernel.org>

But this one should not have a Fixes tag and does not need to be
backported.

> Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
> ---
>  drivers/usb/core/hub.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 3345b3298daf..dec6d5c49759 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2745,6 +2745,7 @@ int usb_new_device(struct usb_device *udev)
>  fail:
>  	usb_set_device_state(udev, USB_STATE_NOTATTACHED);
>  	pm_runtime_disable(&udev->dev);
> +	pm_runtime_dont_use_autosuspend(&udev->dev);
>  	pm_runtime_set_suspended(&udev->dev);
>  	return err;
>  }

Johan

[1] https://lore.kernel.org/all/aivMnTkZ-jTRH2Jy@hovoldconsulting.com/

  parent reply	other threads:[~2026-09-16  8:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  9:02 [PATCH 0/6] usb: add missing pm_runtime_dont_use_autosuspend() calls Joshua Crofts
2026-09-15  9:02 ` [PATCH 1/6] usb: core: add missing pm_runtime_dont_use_autosuspend() call Joshua Crofts
2026-09-15 15:02   ` Alan Stern
2026-09-16  8:08   ` Johan Hovold [this message]
2026-09-16  8:21     ` Joshua Crofts
2026-09-16  9:14       ` Johan Hovold
2026-09-15  9:02 ` [PATCH 2/6] usb: xhci-mtk: " Joshua Crofts
2026-09-15  9:10   ` AngeloGioacchino Del Regno
2026-09-16  8:16   ` Johan Hovold
2026-09-15  9:02 ` [PATCH 3/6] usb: xhci: add missing pm_runtime_dont_use_autosuspend() calls Joshua Crofts
2026-09-15  9:02 ` [PATCH 4/6] usb: typec: ucsi: ccg: add missing pm_runtime_dont_use_autosuspend() call Joshua Crofts
2026-09-15  9:02 ` [PATCH 5/6] usb: mtu3: add missing pm_runtime_dont_use_autosuspend() calls Joshua Crofts
2026-09-15  9:10   ` AngeloGioacchino Del Regno
2026-09-15  9:02 ` [PATCH 6/6] usb: cdns3: add missing pm_runtime_dont_use_autosuspend() call Joshua Crofts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqpOlKtxeROh-G_s@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=pawell@cadence.com \
    --cc=peter.chen@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®