From: Fedor Pchelkin <pchelkin@ispras.ru>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org
Cc: Alan Stern <stern@rowland.harvard.edu>,
Vitalii Mordan <mordan@ispras.ru>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
linux-sh@vger.kernel.org,
Alexey Khoroshilov <khoroshilov@ispras.ru>,
Vadim Mutilin <mutilin@ispras.ru>,
stable@vger.kernel.org
Subject: Re: [PATCH] usb: ehci-hcd: fix call balance of clocks handling routines
Date: Mon, 23 Dec 2024 12:46:30 +0300 [thread overview]
Message-ID: <20241223-7a6c874adb4a809293a4dca6-pchelkin@ispras.ru> (raw)
In-Reply-To: <20241121114700.2100520-1-mordan@ispras.ru>
On Thu, 21. Nov 14:47, Vitalii Mordan wrote:
> If the clocks priv->iclk and priv->fclk were not enabled in ehci_hcd_sh_probe,
> they should not be disabled in any path.
>
> Conversely, if they was enabled in ehci_hcd_sh_probe, they must be disabled
> in all error paths to ensure proper cleanup.
>
> Found by Linux Verification Center (linuxtesting.org) with Klever.
>
> Fixes: 63c845522263 ("usb: ehci-hcd: Add support for SuperH EHCI.")
> Cc: stable@vger.kernel.org # ff30bd6a6618: sh: clk: Fix clk_enable() to return 0 on NULL clk
> Signed-off-by: Vitalii Mordan <mordan@ispras.ru>
> ---
The current patch was added to stable kernels lacking the necessary
prerequisite ff30bd6a6618 ("sh: clk: Fix clk_enable() to return 0 on
NULL clk") which is specified in Cc:stable tag of the commit description
per stable kernels documentation [1].
[1]: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1
Could you please cherry-pick ff30bd6a6618 ("sh: clk: Fix clk_enable() to
return 0 on NULL clk") to 6.1.y, 5.15.y, 5.10.y and 5.4.y ? It applies
cleanly.
Thanks!
> drivers/usb/host/ehci-sh.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
> index d31d9506e41a..77460aac6dbd 100644
> --- a/drivers/usb/host/ehci-sh.c
> +++ b/drivers/usb/host/ehci-sh.c
> @@ -119,8 +119,12 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
> if (IS_ERR(priv->iclk))
> priv->iclk = NULL;
>
> - clk_enable(priv->fclk);
> - clk_enable(priv->iclk);
> + ret = clk_enable(priv->fclk);
> + if (ret)
> + goto fail_request_resource;
> + ret = clk_enable(priv->iclk);
> + if (ret)
> + goto fail_iclk;
>
> ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
> if (ret != 0) {
> @@ -136,6 +140,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
>
> fail_add_hcd:
> clk_disable(priv->iclk);
> +fail_iclk:
> clk_disable(priv->fclk);
>
> fail_request_resource:
> --
> 2.25.1
>
prev parent reply other threads:[~2024-12-23 9:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 11:47 [PATCH] usb: ehci-hcd: fix call balance of clocks handling routines Vitalii Mordan
2024-11-21 14:14 ` Alan Stern
2024-12-23 9:46 ` Fedor Pchelkin [this message]
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=20241223-7a6c874adb4a809293a4dca6-pchelkin@ispras.ru \
--to=pchelkin@ispras.ru \
--cc=dalias@libc.org \
--cc=geert+renesas@glider.be \
--cc=glaubitz@physik.fu-berlin.de \
--cc=gregkh@linuxfoundation.org \
--cc=khoroshilov@ispras.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mordan@ispras.ru \
--cc=mutilin@ispras.ru \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=ysato@users.sourceforge.jp \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).