All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define
@ 2015-10-25 23:21 Alexey Klimov
  2015-10-25 23:21 ` [PATCH v3 2/3] clocksource: mtk_timer: fix pr_warn() messages in mtk_timer_init Alexey Klimov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexey Klimov @ 2015-10-25 23:21 UTC (permalink / raw)
  To: daniel.lezcano, matthias.bgg, linux-kernel, joe
  Cc: linux-mediatek, yingjoe.chen, tglx, klimov.linux, Alexey Klimov

It's a bit unclear what subsystem/driver emits some messages
to dmesg in function mtk_init_timer().
Use pr_fmt to auto-prefix the messages appropriately.

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
Changes in v3:
  -- none

Changes in v2:
  -- added acked-by from Matthias

 drivers/clocksource/mtk_timer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 50f0641..ca5ea9e 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -16,6 +16,8 @@
  * GNU General Public License for more details.
  */
 
+#define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
+
 #include <linux/clk.h>
 #include <linux/clockchips.h>
 #include <linux/interrupt.h>
-- 
2.1.4

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

* [PATCH v3 2/3] clocksource: mtk_timer: fix pr_warn() messages in mtk_timer_init
  2015-10-25 23:21 [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define Alexey Klimov
@ 2015-10-25 23:21 ` Alexey Klimov
  2015-10-25 23:21 ` [PATCH v3 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init() Alexey Klimov
  2015-10-27 10:21 ` [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define Daniel Lezcano
  2 siblings, 0 replies; 4+ messages in thread
From: Alexey Klimov @ 2015-10-25 23:21 UTC (permalink / raw)
  To: daniel.lezcano, matthias.bgg, linux-kernel, joe
  Cc: linux-mediatek, yingjoe.chen, tglx, klimov.linux, Alexey Klimov

1) Change pr_warn()s to pr_err()s. These messages are actually
errors and not warnings.
2) Add missing \n.
3) Error message for kzalloc() failure is removed per suggestion
by Joe Perches. There is generic stack_dump() for allocation issues.

Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
Changes in v3:
  -- small cleanup

Changes in v2:
  -- remove message on allocation failure

 drivers/clocksource/mtk_timer.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index ca5ea9e..4ddddf4 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -183,10 +183,8 @@ static void __init mtk_timer_init(struct device_node *node)
 	struct clk *clk;
 
 	evt = kzalloc(sizeof(*evt), GFP_KERNEL);
-	if (!evt) {
-		pr_warn("Can't allocate mtk clock event driver struct");
+	if (!evt)
 		return;
-	}
 
 	evt->dev.name = "mtk_tick";
 	evt->dev.rating = 300;
@@ -200,24 +198,24 @@ static void __init mtk_timer_init(struct device_node *node)
 
 	evt->gpt_base = of_io_request_and_map(node, 0, "mtk-timer");
 	if (IS_ERR(evt->gpt_base)) {
-		pr_warn("Can't get resource\n");
+		pr_err("Can't get resource\n");
 		return;
 	}
 
 	evt->dev.irq = irq_of_parse_and_map(node, 0);
 	if (evt->dev.irq <= 0) {
-		pr_warn("Can't parse IRQ");
+		pr_err("Can't parse IRQ\n");
 		goto err_mem;
 	}
 
 	clk = of_clk_get(node, 0);
 	if (IS_ERR(clk)) {
-		pr_warn("Can't get timer clock");
+		pr_err("Can't get timer clock\n");
 		goto err_irq;
 	}
 
 	if (clk_prepare_enable(clk)) {
-		pr_warn("Can't prepare clock");
+		pr_err("Can't prepare clock\n");
 		goto err_clk_put;
 	}
 	rate = clk_get_rate(clk);
@@ -226,7 +224,7 @@ static void __init mtk_timer_init(struct device_node *node)
 
 	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
 			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
-		pr_warn("failed to setup irq %d\n", evt->dev.irq);
+		pr_err("failed to setup irq %d\n", evt->dev.irq);
 		goto err_clk_disable;
 	}
 
-- 
2.1.4

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

* [PATCH v3 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init()
  2015-10-25 23:21 [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define Alexey Klimov
  2015-10-25 23:21 ` [PATCH v3 2/3] clocksource: mtk_timer: fix pr_warn() messages in mtk_timer_init Alexey Klimov
@ 2015-10-25 23:21 ` Alexey Klimov
  2015-10-27 10:21 ` [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define Daniel Lezcano
  2 siblings, 0 replies; 4+ messages in thread
From: Alexey Klimov @ 2015-10-25 23:21 UTC (permalink / raw)
  To: daniel.lezcano, matthias.bgg, linux-kernel, joe
  Cc: linux-mediatek, yingjoe.chen, tglx, klimov.linux, Alexey Klimov

Add error path to clear evt struct allocated by kzalloc()
in the beginning of function mtk_timer_init().

Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
Changes in v3:
  -- none

Changes in v2:
  -- added acked-by from Matthias

 drivers/clocksource/mtk_timer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 4ddddf4..454c00e 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -199,7 +199,7 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->gpt_base = of_io_request_and_map(node, 0, "mtk-timer");
 	if (IS_ERR(evt->gpt_base)) {
 		pr_err("Can't get resource\n");
-		return;
+		goto err_kzalloc;
 	}
 
 	evt->dev.irq = irq_of_parse_and_map(node, 0);
@@ -254,5 +254,7 @@ err_mem:
 	iounmap(evt->gpt_base);
 	of_address_to_resource(node, 0, &res);
 	release_mem_region(res.start, resource_size(&res));
+err_kzalloc:
+	kfree(evt);
 }
 CLOCKSOURCE_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);
-- 
2.1.4

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

* Re: [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define
  2015-10-25 23:21 [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define Alexey Klimov
  2015-10-25 23:21 ` [PATCH v3 2/3] clocksource: mtk_timer: fix pr_warn() messages in mtk_timer_init Alexey Klimov
  2015-10-25 23:21 ` [PATCH v3 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init() Alexey Klimov
@ 2015-10-27 10:21 ` Daniel Lezcano
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2015-10-27 10:21 UTC (permalink / raw)
  To: Alexey Klimov, matthias.bgg, linux-kernel, joe
  Cc: linux-mediatek, yingjoe.chen, tglx, klimov.linux

On 10/26/2015 12:21 AM, Alexey Klimov wrote:
> It's a bit unclear what subsystem/driver emits some messages
> to dmesg in function mtk_init_timer().
> Use pr_fmt to auto-prefix the messages appropriately.
>
> Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> ---

Patches applied for next release.

Thanks !

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

end of thread, other threads:[~2015-10-27 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-25 23:21 [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define Alexey Klimov
2015-10-25 23:21 ` [PATCH v3 2/3] clocksource: mtk_timer: fix pr_warn() messages in mtk_timer_init Alexey Klimov
2015-10-25 23:21 ` [PATCH v3 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init() Alexey Klimov
2015-10-27 10:21 ` [PATCH v3 1/3] clocksource: mtk_timer: add pr_fmt define Daniel Lezcano

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.