* [PATCH 0/9] Change return type of of_clk_get_parent_count() to unsigned
@ 2016-02-22 20:54 Stephen Boyd
2016-02-22 20:54 ` [PATCH 9/9] simplefb: Remove impossible check for of_clk_get_parent_count() < 0 Stephen Boyd
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2016-02-22 20:54 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-kernel, linux-clk, Boris Brezillon, Yoshinori Sato,
uclinux-h8-devel, Gabriel Fernandez, Maxime Ripard, Chen-Yu Tsai,
Tero Kristo, Felipe Balbi, linux-usb, Hans de Goede,
Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
Russell King recently pointed out that of_clk_get_parent_count() can
return a negative number if the "clocks" property isn't present in a
node. Upon investigating all the callers of this API, none of the them
seem to care about that case, and furthermore some callers are assigning
the return value to an unsigned int which could cause very large numbers
of parents to be used.
This series changes the API to return an unsigned int from 0 (no parents)
to N, thereby avoiding any problems with negative return values.
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: <uclinux-h8-devel@lists.sourceforge.jp>
Cc: Gabriel Fernandez <gabriel.fernandez@st.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: <linux-usb@vger.kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
Stephen Boyd (9):
clk: Make of_clk_get_parent_count() return unsigned ints
clk: at91: Remove impossible checks for of_clk_get_parent_count()
clk: gpio: Remove impossible check for of_clk_get_parent_count() < 0
clk: h8300: Remove impossible check for of_clk_get_parent_count()
clk: st: Remove impossible check for of_clk_get_parent_count() < 0
clk: sunxi: Use proper type for of_clk_get_parent_count() return value
clk: ti: Update for of_clk_get_parent_count() returning unsigned int
usb: dwc3: Remove impossible check for of_clk_get_parent_count() < 0
simplefb: Remove impossible check for of_clk_get_parent_count() < 0
drivers/clk/at91/clk-generated.c | 4 ++--
drivers/clk/at91/clk-main.c | 4 ++--
drivers/clk/at91/clk-master.c | 4 ++--
drivers/clk/at91/clk-programmable.c | 4 ++--
drivers/clk/at91/clk-slow.c | 6 +++---
drivers/clk/at91/clk-smd.c | 4 ++--
drivers/clk/at91/clk-usb.c | 4 ++--
drivers/clk/clk-gpio.c | 6 ++----
drivers/clk/clk.c | 16 ++++++++++++++--
drivers/clk/h8300/clk-div.c | 4 ++--
drivers/clk/h8300/clk-h8s2678.c | 4 ++--
drivers/clk/st/clk-flexgen.c | 4 ++--
drivers/clk/st/clkgen-mux.c | 4 ++--
drivers/clk/sunxi/clk-sun6i-ar100.c | 2 +-
drivers/clk/ti/clockdomain.c | 2 +-
drivers/clk/ti/composite.c | 8 ++++----
drivers/clk/ti/dpll.c | 2 +-
drivers/clk/ti/mux.c | 4 ++--
drivers/usb/dwc3/dwc3-of-simple.c | 9 +++++----
drivers/video/fbdev/simplefb.c | 4 ++--
include/linux/clk-provider.h | 2 +-
21 files changed, 56 insertions(+), 45 deletions(-)
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 9/9] simplefb: Remove impossible check for of_clk_get_parent_count() < 0
2016-02-22 20:54 [PATCH 0/9] Change return type of of_clk_get_parent_count() to unsigned Stephen Boyd
@ 2016-02-22 20:54 ` Stephen Boyd
2016-02-26 11:35 ` Tomi Valkeinen
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2016-02-22 20:54 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-kernel, linux-clk, Hans de Goede,
Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev
The check for < 0 is impossible now that
of_clk_get_parent_count() returns an unsigned int. Simplify the
code and update the types.
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
Please ack so this can go through clk tree along with patch 1.
drivers/video/fbdev/simplefb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c
index 48ccf6db62a2..e9cf19977285 100644
--- a/drivers/video/fbdev/simplefb.c
+++ b/drivers/video/fbdev/simplefb.c
@@ -174,7 +174,7 @@ static int simplefb_parse_pd(struct platform_device *pdev,
struct simplefb_par {
u32 palette[PSEUDO_PALETTE_SIZE];
#if defined CONFIG_OF && defined CONFIG_COMMON_CLK
- int clk_count;
+ unsigned int clk_count;
struct clk **clks;
#endif
#if defined CONFIG_OF && defined CONFIG_REGULATOR
@@ -213,7 +213,7 @@ static int simplefb_clocks_init(struct simplefb_par *par,
return 0;
par->clk_count = of_clk_get_parent_count(np);
- if (par->clk_count <= 0)
+ if (!par->clk_count)
return 0;
par->clks = kcalloc(par->clk_count, sizeof(struct clk *), GFP_KERNEL);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 9/9] simplefb: Remove impossible check for of_clk_get_parent_count() < 0
2016-02-22 20:54 ` [PATCH 9/9] simplefb: Remove impossible check for of_clk_get_parent_count() < 0 Stephen Boyd
@ 2016-02-26 11:35 ` Tomi Valkeinen
0 siblings, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2016-02-26 11:35 UTC (permalink / raw)
To: Stephen Boyd, Michael Turquette
Cc: linux-kernel, linux-clk, Hans de Goede,
Jean-Christophe Plagniol-Villard, linux-fbdev
[-- Attachment #1.1: Type: text/plain, Size: 673 bytes --]
On 22/02/16 22:54, Stephen Boyd wrote:
> The check for < 0 is impossible now that
> of_clk_get_parent_count() returns an unsigned int. Simplify the
> code and update the types.
>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: <linux-fbdev@vger.kernel.org>
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
>
> Please ack so this can go through clk tree along with patch 1.
>
> drivers/video/fbdev/simplefb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-26 11:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 20:54 [PATCH 0/9] Change return type of of_clk_get_parent_count() to unsigned Stephen Boyd
2016-02-22 20:54 ` [PATCH 9/9] simplefb: Remove impossible check for of_clk_get_parent_count() < 0 Stephen Boyd
2016-02-26 11:35 ` Tomi Valkeinen
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).