All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] TI clk driver cleanups
@ 2015-07-15 20:08 Stephen Boyd
  2015-07-15 20:08 ` [PATCH 1/4] clk: ti: Check kzalloc() for failures Stephen Boyd
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Stephen Boyd @ 2015-07-15 20:08 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd; +Cc: linux-kernel, linux-clk, Tero Kristo

Some cleanups for the TI clk driver move.

Stephen Boyd (4):
  clk: ti: Check kzalloc() for failures
  clk: ti: Mark ti_clk_features static
  clk: ti: clk-3xxx: Remove unused structures
  clk: ti: Force pointer to be __iomem

 drivers/clk/ti/clk-3xxx.c | 10 ----------
 drivers/clk/ti/clk.c      |  6 ++++--
 2 files changed, 4 insertions(+), 12 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] clk: ti: Check kzalloc() for failures
  2015-07-15 20:08 [PATCH 0/4] TI clk driver cleanups Stephen Boyd
@ 2015-07-15 20:08 ` Stephen Boyd
  2015-07-15 20:08 ` [PATCH 2/4] clk: ti: Mark ti_clk_features static Stephen Boyd
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2015-07-15 20:08 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd; +Cc: linux-kernel, linux-clk, Tero Kristo

smatch reports a failure to check kzalloc() here:

drivers/clk/ti/clk.c:232
omap2_clk_provider_init() error: potential null dereference 'io'.
(kzalloc returns null)

Check for an allocation failure and return -ENOMEM.

Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/ti/clk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index 7e037c45e459..931b44118bdf 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -228,6 +228,8 @@ int __init omap2_clk_provider_init(struct device_node *parent, int index,
 	clocks_node_ptr[index] = clocks;
 
 	io = kzalloc(sizeof(*io), GFP_KERNEL);
+	if (!io)
+		return -ENOMEM;
 
 	io->regmap = syscon;
 	io->mem = mem;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] clk: ti: Mark ti_clk_features static
  2015-07-15 20:08 [PATCH 0/4] TI clk driver cleanups Stephen Boyd
  2015-07-15 20:08 ` [PATCH 1/4] clk: ti: Check kzalloc() for failures Stephen Boyd
@ 2015-07-15 20:08 ` Stephen Boyd
  2015-07-15 20:08 ` [PATCH 3/4] clk: ti: clk-3xxx: Remove unused structures Stephen Boyd
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2015-07-15 20:08 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd; +Cc: linux-kernel, linux-clk, Tero Kristo

This variable isn't exported outside of this file so mark it
static. Silences the following sparse warning:

drivers/clk/ti/clk.c:36:24: warning: symbol 'ti_clk_features' was not declared. Should it be static?

Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/ti/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index 931b44118bdf..5dcc1bdfc7f4 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -33,7 +33,7 @@
 struct ti_clk_ll_ops *ti_clk_ll_ops;
 static struct device_node *clocks_node_ptr[CLK_MAX_MEMMAPS];
 
-struct ti_clk_features ti_clk_features;
+static struct ti_clk_features ti_clk_features;
 
 struct clk_iomap {
 	struct regmap *regmap;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] clk: ti: clk-3xxx: Remove unused structures
  2015-07-15 20:08 [PATCH 0/4] TI clk driver cleanups Stephen Boyd
  2015-07-15 20:08 ` [PATCH 1/4] clk: ti: Check kzalloc() for failures Stephen Boyd
  2015-07-15 20:08 ` [PATCH 2/4] clk: ti: Mark ti_clk_features static Stephen Boyd
@ 2015-07-15 20:08 ` Stephen Boyd
  2015-07-16  8:42   ` Tero Kristo
  2015-07-15 20:08 ` [PATCH 4/4] clk: ti: Force pointer to be __iomem Stephen Boyd
  2015-07-16  8:43 ` [PATCH 0/4] TI clk driver cleanups Tero Kristo
  4 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2015-07-15 20:08 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd; +Cc: linux-kernel, linux-clk, Tero Kristo

Sparse complains about these structures missing static, but they
also don't look to be used. Remove them.

drivers/clk/ti/clk-3xxx.c:74:30: warning: symbol 'clkhwops_omap3430es2_ssi_wait' was not declared. Should it be static?
drivers/clk/ti/clk-3xxx.c:157:30: warning: symbol 'clkhwops_omap3430es2_hsotgusb_wait' was not declared. Should it be static?

Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/ti/clk-3xxx.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/clk/ti/clk-3xxx.c b/drivers/clk/ti/clk-3xxx.c
index bd8291b53fd0..676ee8f6d813 100644
--- a/drivers/clk/ti/clk-3xxx.c
+++ b/drivers/clk/ti/clk-3xxx.c
@@ -71,11 +71,6 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
 	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
 }
 
-const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
-	.find_idlest	= omap3430es2_clk_ssi_find_idlest,
-	.find_companion	= omap2_clk_dflt_find_companion,
-};
-
 const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
 	.allow_idle	= omap2_clkt_iclk_allow_idle,
 	.deny_idle	= omap2_clkt_iclk_deny_idle,
@@ -154,11 +149,6 @@ const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
 	.find_companion	= omap2_clk_dflt_find_companion,
 };
 
-const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
-	.find_idlest	= omap3430es2_clk_hsotgusb_find_idlest,
-	.find_companion	= omap2_clk_dflt_find_companion,
-};
-
 /**
  * am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS
  * @clk: struct clk * being enabled
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] clk: ti: Force pointer to be __iomem
  2015-07-15 20:08 [PATCH 0/4] TI clk driver cleanups Stephen Boyd
                   ` (2 preceding siblings ...)
  2015-07-15 20:08 ` [PATCH 3/4] clk: ti: clk-3xxx: Remove unused structures Stephen Boyd
@ 2015-07-15 20:08 ` Stephen Boyd
  2015-07-16  8:43 ` [PATCH 0/4] TI clk driver cleanups Tero Kristo
  4 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2015-07-15 20:08 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd; +Cc: linux-kernel, linux-clk, Tero Kristo

Add __force here so that sparse doesn't complain about us playing
tricks with __iomem.

Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---

This whole scheme is really ugly, hopefully it can be cleaned up soon.

 drivers/clk/ti/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index 5dcc1bdfc7f4..ace35047783b 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -194,7 +194,7 @@ void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index)
 
 	reg->offset = val;
 
-	return (void __iomem *)tmp;
+	return (__force void __iomem *)tmp;
 }
 
 /**
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/4] clk: ti: clk-3xxx: Remove unused structures
  2015-07-15 20:08 ` [PATCH 3/4] clk: ti: clk-3xxx: Remove unused structures Stephen Boyd
@ 2015-07-16  8:42   ` Tero Kristo
  0 siblings, 0 replies; 7+ messages in thread
From: Tero Kristo @ 2015-07-16  8:42 UTC (permalink / raw)
  To: Stephen Boyd, Mike Turquette; +Cc: linux-kernel, linux-clk

On 07/15/2015 11:08 PM, Stephen Boyd wrote:
> Sparse complains about these structures missing static, but they
> also don't look to be used. Remove them.
>
> drivers/clk/ti/clk-3xxx.c:74:30: warning: symbol 'clkhwops_omap3430es2_ssi_wait' was not declared. Should it be static?
> drivers/clk/ti/clk-3xxx.c:157:30: warning: symbol 'clkhwops_omap3430es2_hsotgusb_wait' was not declared. Should it be static?

Interesting, I wonder if the references to these have accidentally been 
dropped at some point, namely (in 2012?) when we converted the clocks to 
use common clock struct.

Anyway, I guess we can fix the ssi/usb clocks later if we find some 
issues with them, its been at least 3 years since these have been used.

-Tero

>
> Cc: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
>   drivers/clk/ti/clk-3xxx.c | 10 ----------
>   1 file changed, 10 deletions(-)
>
> diff --git a/drivers/clk/ti/clk-3xxx.c b/drivers/clk/ti/clk-3xxx.c
> index bd8291b53fd0..676ee8f6d813 100644
> --- a/drivers/clk/ti/clk-3xxx.c
> +++ b/drivers/clk/ti/clk-3xxx.c
> @@ -71,11 +71,6 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
>   	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
>   }
>
> -const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
> -	.find_idlest	= omap3430es2_clk_ssi_find_idlest,
> -	.find_companion	= omap2_clk_dflt_find_companion,
> -};
> -
>   const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
>   	.allow_idle	= omap2_clkt_iclk_allow_idle,
>   	.deny_idle	= omap2_clkt_iclk_deny_idle,
> @@ -154,11 +149,6 @@ const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
>   	.find_companion	= omap2_clk_dflt_find_companion,
>   };
>
> -const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
> -	.find_idlest	= omap3430es2_clk_hsotgusb_find_idlest,
> -	.find_companion	= omap2_clk_dflt_find_companion,
> -};
> -
>   /**
>    * am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS
>    * @clk: struct clk * being enabled
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] TI clk driver cleanups
  2015-07-15 20:08 [PATCH 0/4] TI clk driver cleanups Stephen Boyd
                   ` (3 preceding siblings ...)
  2015-07-15 20:08 ` [PATCH 4/4] clk: ti: Force pointer to be __iomem Stephen Boyd
@ 2015-07-16  8:43 ` Tero Kristo
  4 siblings, 0 replies; 7+ messages in thread
From: Tero Kristo @ 2015-07-16  8:43 UTC (permalink / raw)
  To: Stephen Boyd, Mike Turquette; +Cc: linux-kernel, linux-clk

On 07/15/2015 11:08 PM, Stephen Boyd wrote:
> Some cleanups for the TI clk driver move.
>
> Stephen Boyd (4):
>    clk: ti: Check kzalloc() for failures
>    clk: ti: Mark ti_clk_features static
>    clk: ti: clk-3xxx: Remove unused structures
>    clk: ti: Force pointer to be __iomem
>
>   drivers/clk/ti/clk-3xxx.c | 10 ----------
>   drivers/clk/ti/clk.c      |  6 ++++--
>   2 files changed, 4 insertions(+), 12 deletions(-)
>

For the whole set:

Acked-by: Tero Kristo <t-kristo@ti.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-07-16  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-15 20:08 [PATCH 0/4] TI clk driver cleanups Stephen Boyd
2015-07-15 20:08 ` [PATCH 1/4] clk: ti: Check kzalloc() for failures Stephen Boyd
2015-07-15 20:08 ` [PATCH 2/4] clk: ti: Mark ti_clk_features static Stephen Boyd
2015-07-15 20:08 ` [PATCH 3/4] clk: ti: clk-3xxx: Remove unused structures Stephen Boyd
2015-07-16  8:42   ` Tero Kristo
2015-07-15 20:08 ` [PATCH 4/4] clk: ti: Force pointer to be __iomem Stephen Boyd
2015-07-16  8:43 ` [PATCH 0/4] TI clk driver cleanups Tero Kristo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.