Re: [PATCH] Enable clock before calling clk_get_rate() on it.

2018-05-02 Thread Stefan Potyra
Hi Evgeniy,

On Mon, Apr 30, 2018 at 06:02:57PM +0300, Evgeniy Polyakov wrote:
> Hi Stefan
> 
> Nice catch, thank you!
> 
> 19.04.2018, 16:02, "Stefan Potyra" :
> > 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 
> 
> Acked-by: Evgeniy Polyakov 

Oops, just saw that now the clock is leaked in the error case of mdev->regs.
I'll respin the patch and fix that.

Cheers,
  Stefan.


signature.asc
Description: PGP signature


Re: [PATCH] Enable clock before calling clk_get_rate() on it.

2018-05-02 Thread Stefan Potyra
Hi Evgeniy,

On Mon, Apr 30, 2018 at 06:02:57PM +0300, Evgeniy Polyakov wrote:
> Hi Stefan
> 
> Nice catch, thank you!
> 
> 19.04.2018, 16:02, "Stefan Potyra" :
> > 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 
> 
> Acked-by: Evgeniy Polyakov 

Oops, just saw that now the clock is leaked in the error case of mdev->regs.
I'll respin the patch and fix that.

Cheers,
  Stefan.


signature.asc
Description: PGP signature


Re: [PATCH] Enable clock before calling clk_get_rate() on it.

2018-04-30 Thread Evgeniy Polyakov
Hi Stefan

Nice catch, thank you!

19.04.2018, 16:02, "Stefan Potyra" :
> 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 

Acked-by: Evgeniy Polyakov 

Greg, please pull it into your tree. Is this a stable material?

> ---
>  drivers/w1/masters/mxc_w1.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
> index 74f2e6e6202a..a9599027d4ef 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 < 1000)
>  dev_warn(>dev,
> @@ -128,10 +132,6 @@ static int mxc_w1_probe(struct platform_device *pdev)
>  if (IS_ERR(mdev->regs))
>  return PTR_ERR(mdev->regs);
>
> - err = clk_prepare_enable(mdev->clk);
> - if (err)
> - return err;
> -
>  /* Software reset 1-Wire module */
>  writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET);
>  writeb(0, mdev->regs + MXC_W1_RESET);
> --
> 2.17.0


Re: [PATCH] Enable clock before calling clk_get_rate() on it.

2018-04-30 Thread Evgeniy Polyakov
Hi Stefan

Nice catch, thank you!

19.04.2018, 16:02, "Stefan Potyra" :
> 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 

Acked-by: Evgeniy Polyakov 

Greg, please pull it into your tree. Is this a stable material?

> ---
>  drivers/w1/masters/mxc_w1.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
> index 74f2e6e6202a..a9599027d4ef 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 < 1000)
>  dev_warn(>dev,
> @@ -128,10 +132,6 @@ static int mxc_w1_probe(struct platform_device *pdev)
>  if (IS_ERR(mdev->regs))
>  return PTR_ERR(mdev->regs);
>
> - err = clk_prepare_enable(mdev->clk);
> - if (err)
> - return err;
> -
>  /* Software reset 1-Wire module */
>  writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET);
>  writeb(0, mdev->regs + MXC_W1_RESET);
> --
> 2.17.0


[PATCH] Enable clock before calling clk_get_rate() on it.

2018-04-19 Thread Stefan Potyra
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 
---
 drivers/w1/masters/mxc_w1.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index 74f2e6e6202a..a9599027d4ef 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 < 1000)
dev_warn(>dev,
@@ -128,10 +132,6 @@ static int mxc_w1_probe(struct platform_device *pdev)
if (IS_ERR(mdev->regs))
return PTR_ERR(mdev->regs);
 
-   err = clk_prepare_enable(mdev->clk);
-   if (err)
-   return err;
-
/* Software reset 1-Wire module */
writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET);
writeb(0, mdev->regs + MXC_W1_RESET);
-- 
2.17.0



[PATCH] Enable clock before calling clk_get_rate() on it.

2018-04-19 Thread Stefan Potyra
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 
---
 drivers/w1/masters/mxc_w1.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index 74f2e6e6202a..a9599027d4ef 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 < 1000)
dev_warn(>dev,
@@ -128,10 +132,6 @@ static int mxc_w1_probe(struct platform_device *pdev)
if (IS_ERR(mdev->regs))
return PTR_ERR(mdev->regs);
 
-   err = clk_prepare_enable(mdev->clk);
-   if (err)
-   return err;
-
/* Software reset 1-Wire module */
writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET);
writeb(0, mdev->regs + MXC_W1_RESET);
-- 
2.17.0