diff mbox series

[v5,3/3] blackfin: bf609: let clk_disable() return immediately if clk is NULL

Message ID 1490692624-11931-4-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit accce8e7e8b769ec2430bc0f4a8a2b23c68c1837
Headers show
Series clk: let clk_disable() return immediately if clk is NULL for last 3 clks | expand

Commit Message

Masahiro Yamada March 28, 2017, 9:17 a.m. UTC
In many of clk_disable() implementations, it is a no-op for a NULL
pointer input, but this is one of the exceptions.

Making it treewide consistent will allow clock consumers to call
clk_disable() without NULL pointer check.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

Changes in v5: None
Changes in v4:
  - Split into per-arch patches

Changes in v3:
  - Return only when clk is NULL.  Do not take care of error pointer.

Changes in v2:
  - Rebase on Linux 4.6-rc1

 arch/blackfin/mach-bf609/clock.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.7.4

Comments

Masahiro Yamada April 13, 2017, 3:33 a.m. UTC | #1
Hi Andrew

2017-03-28 18:17 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> In many of clk_disable() implementations, it is a no-op for a NULL

> pointer input, but this is one of the exceptions.

>

> Making it treewide consistent will allow clock consumers to call

> clk_disable() without NULL pointer check.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>



This is the last clk_disable() that could cause NULL pointer access.
This is blocking clk consumer cleanup works.

I poked the Blackfin maintainer several times, but no response.
Actually, the maintainer has not been picking up any patches for a long time.

Please pick up this patch through your tree.



> ---

>

> Changes in v5: None

> Changes in v4:

>   - Split into per-arch patches

>

> Changes in v3:

>   - Return only when clk is NULL.  Do not take care of error pointer.

>

> Changes in v2:

>   - Rebase on Linux 4.6-rc1

>

>  arch/blackfin/mach-bf609/clock.c | 3 +++

>  1 file changed, 3 insertions(+)

>

> diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c

> index 3783058..392a59b 100644

> --- a/arch/blackfin/mach-bf609/clock.c

> +++ b/arch/blackfin/mach-bf609/clock.c

> @@ -97,6 +97,9 @@ EXPORT_SYMBOL(clk_enable);

>

>  void clk_disable(struct clk *clk)

>  {

> +       if (!clk)

> +               return;

> +

>         if (clk->ops && clk->ops->disable)

>                 clk->ops->disable(clk);

>  }

> --

> 2.7.4

>




-- 
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
index 3783058..392a59b 100644
--- a/arch/blackfin/mach-bf609/clock.c
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -97,6 +97,9 @@  EXPORT_SYMBOL(clk_enable);
 
 void clk_disable(struct clk *clk)
 {
+	if (!clk)
+		return;
+
 	if (clk->ops && clk->ops->disable)
 		clk->ops->disable(clk);
 }