linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Felipe Balbi <balbi@kernel.org>
Cc: ldv-project@linuxtesting.org, linux-samsung-soc@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Kukjin Kim <kgene@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] usb: dwc3: exynos: Fix error handling of clk_prepare_enable
Date: Mon, 21 Jan 2019 10:56:46 +0100	[thread overview]
Message-ID: <abc0f943-1d34-cc44-dc65-0428d6188354@samsung.com> (raw)
In-Reply-To: <1547846257-19970-1-git-send-email-khoroshilov@ispras.ru>

Hi Alexey,

On 2019-01-18 22:17, Alexey Khoroshilov wrote:
> If clk_prepare_enable() fails in dwc3_exynos_probe(),
> exynos->clks[0] is left undisabled because of usage
> preincrement in while condition.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Fixes: 9f2168367a0a ("usb: dwc3: exynos: Rework clock handling and prepare for new variants")

My fault. There is also a similar issue dwc3_exynos_resume(), so please
fix it too if possible.

> ---
>  drivers/usb/dwc3/dwc3-exynos.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
> index cb7fcd7c0ad8..e7f6cff27b9a 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -78,7 +78,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
>  	for (i = 0; i < exynos->num_clks; i++) {
>  		ret = clk_prepare_enable(exynos->clks[i]);
>  		if (ret) {
> -			while (--i > 0)
> +			while (i-- > 0)
>  				clk_disable_unprepare(exynos->clks[i]);
>  			return ret;
>  		}

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2019-01-21  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190118211823epcas1p32d11bff9f7822eb48c0387c85a94da70@epcas1p3.samsung.com>
2019-01-18 21:17 ` [PATCH] usb: dwc3: exynos: Fix error handling of clk_prepare_enable Alexey Khoroshilov
2019-01-21  9:56   ` Marek Szyprowski [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=abc0f943-1d34-cc44-dc65-0428d6188354@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=balbi@kernel.org \
    --cc=kgene@kernel.org \
    --cc=khoroshilov@ispras.ru \
    --cc=krzk@kernel.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@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;
as well as URLs for NNTP newsgroup(s).