mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <zbr@ioremap.net>
To: Stefan Potyra <stefan.potyra@elektrobit.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"ldv-project@linuxtesting.org" <ldv-project@linuxtesting.org>,
	"sil2review@lists.osadl.org" <sil2review@lists.osadl.org>
Subject: Re: [PATCH v2] w1: mxc_w1: Enable clock before calling clk_get_rate() on it
Date: Tue, 08 May 2018 14:02:17 +0300	[thread overview]
Message-ID: <692971525777337@web22j.yandex.ru> (raw)
In-Reply-To: <20180502085531.GA10525@er01809n.ebgroup.elektrobit.com>

Hi Stefan

02.05.2018, 11:55, "Stefan Potyra" <stefan.potyra@elektrobit.com>:
> According to the API, you may only call clk_get_rate() after actually
> enabling it.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Fixes: a5fd9139f74c ("w1: add 1-wire master driver for i.MX27 / i.MX31")
> Signed-off-by: Stefan Potyra <Stefan.Potyra@elektrobit.com>

Looks good to me, thank you!
Greg, please pull it into your tree, this also sounds like stable material, is it?

Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

> ---
>  drivers/w1/masters/mxc_w1.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
> index 74f2e6e6202a..8851d441e5fd 100644
> --- a/drivers/w1/masters/mxc_w1.c
> +++ b/drivers/w1/masters/mxc_w1.c
> @@ -112,6 +112,10 @@ static int mxc_w1_probe(struct platform_device *pdev)
>          if (IS_ERR(mdev->clk))
>                  return PTR_ERR(mdev->clk);
>
> + err = clk_prepare_enable(mdev->clk);
> + if (err)
> + return err;
> +
>          clkrate = clk_get_rate(mdev->clk);
>          if (clkrate < 10000000)
>                  dev_warn(&pdev->dev,
> @@ -125,12 +129,10 @@ static int mxc_w1_probe(struct platform_device *pdev)
>
>          res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>          mdev->regs = devm_ioremap_resource(&pdev->dev, res);
> - if (IS_ERR(mdev->regs))
> - return PTR_ERR(mdev->regs);
> -
> - err = clk_prepare_enable(mdev->clk);
> - if (err)
> - return err;
> + if (IS_ERR(mdev->regs)) {
> + err = PTR_ERR(mdev->regs);
> + goto out_disable_clk;
> + }
>
>          /* Software reset 1-Wire module */
>          writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET);
> @@ -146,8 +148,12 @@ static int mxc_w1_probe(struct platform_device *pdev)
>
>          err = w1_add_master_device(&mdev->bus_master);
>          if (err)
> - clk_disable_unprepare(mdev->clk);
> + goto out_disable_clk;
>
> + return 0;
> +
> +out_disable_clk:
> + clk_disable_unprepare(mdev->clk);
>          return err;
>  }
>
> --
> 2.17.0

      reply	other threads:[~2018-05-08 11:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 13:02 [PATCH] " Stefan Potyra
2018-04-30 15:02 ` Evgeniy Polyakov
2018-05-02  8:34   ` Stefan Potyra
2018-05-02  8:55     ` [PATCH v2] w1: mxc_w1: " Stefan Potyra
2018-05-08 11:02       ` Evgeniy Polyakov [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=692971525777337@web22j.yandex.ru \
    --to=zbr@ioremap.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sil2review@lists.osadl.org \
    --cc=stefan.potyra@elektrobit.com \
    /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

Powered by JetHome