All of lore.kernel.org
 help / color / mirror / Atom feed
* Warnings from drivers/clk/clk.c
@ 2018-01-10 23:29 Fabio Estevam
  2018-01-11  8:08 ` Uwe Kleine-König
  2018-01-11 21:19 ` Stephen Boyd
  0 siblings, 2 replies; 11+ messages in thread
From: Fabio Estevam @ 2018-01-10 23:29 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Sascha Hauer, Dong Aisheng, linux-clk, Michael Turquette

Hi,

Bootling linux-next 20180110 on a imx53-qsb leads to the following
warning that gets repeated several times:


[    2.776154] ------------[ cut here ]------------
[    2.780909] WARNING: CPU: 0 PID: 1 at ../drivers/clk/clk.c:802
clk_core_disable+0xc4/0xe0
[    2.789107] Modules linked in:
[    2.792198] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
4.15.0-rc7-next-20180110 #1
[    2.799696] Hardware name: Freescale i.MX53 (Device Tree Support)
[    2.805805] Backtrace:
[    2.808290] [<c010d1a0>] (dump_backtrace) from [<c010d460>]
(show_stack+0x18/0x1c)
[    2.815879]  r7:00000000 r6:60000093 r5:00000000 r4:c1079954
[    2.821566] [<c010d448>] (show_stack) from [<c0a33bac>]
(dump_stack+0xb4/0xe8)
[    2.828813] [<c0a33af8>] (dump_stack) from [<c0126144>] (__warn+0xf0/0x11c)
[    2.835795]  r9:00000000 r8:00000322 r7:00000009 r6:c0d425e8
r5:00000000 r4:00000000
[    2.843558] [<c0126054>] (__warn) from [<c0126288>]
(warn_slowpath_null+0x44/0x50)
[    2.851148]  r8:c1008908 r7:c0e0777c r6:c04be730 r5:00000322 r4:c0d425e8
[    2.857870] [<c0126244>] (warn_slowpath_null) from [<c04be730>]
(clk_core_disable+0xc4/0xe0)
[    2.866325]  r6:dc02bb00 r5:dc02a980 r4:dc02a980
[    2.870965] [<c04be66c>] (clk_core_disable) from [<c04bf9e8>]
(clk_core_disable_lock+0x20/0x2c)
[    2.879681]  r5:dc02a980 r4:80000013
[    2.883278] [<c04bf9c8>] (clk_core_disable_lock) from [<c04bfa18>]
(clk_disable+0x24/0x28)
[    2.891559]  r5:c0f6b3e4 r4:0000001c
[    2.895160] [<c04bf9f4>] (clk_disable) from [<c0f233b0>]
(imx_clk_disable_uart+0x50/0x68)
[    2.903365] [<c0f23360>] (imx_clk_disable_uart) from [<c010277c>]
(do_one_initcall+0x50/0x19c)
[    2.911996]  r7:c0e0777c r6:c0f63854 r5:c0f23360 r4:ffffe000
[    2.917678] [<c010272c>] (do_one_initcall) from [<c0f00f00>]
(kernel_init_freeable+0x118/0x1d0)
[    2.926397]  r9:c0f63858 r8:000000f0 r7:c0e0777c r6:c0f63854
r5:c107b540 r4:c0f7525c
[    2.934169] [<c0f00de8>] (kernel_init_freeable) from [<c0a48ec8>]
(kernel_init+0x10/0x118)
[    2.942456]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
r6:00000000 r5:c0a48eb8
[    2.950301]  r4:00000000
[    2.952857] [<c0a48eb8>] (kernel_init) from [<c01010b4>]
(ret_from_fork+0x14/0x20)
[    2.960444] Exception stack(0xdc05dfb0 to 0xdc05dff8)
[    2.965516] dfa0:                                     00000000
00000000 00000000 00000000
[    2.973715] dfc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    2.981912] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    2.988543]  r5:c0a48eb8 r4:00000000
[    2.992135] ---[ end trace 5c23aee63f870994 ]---
[    2.997359] ------------[ cut here ]------------

Does anyone have any ideas on how to fix it?

Thanks

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-10 23:29 Warnings from drivers/clk/clk.c Fabio Estevam
@ 2018-01-11  8:08 ` Uwe Kleine-König
  2018-01-11  9:58   ` Lucas Stach
  2018-01-15 12:24   ` Fabio Estevam
  2018-01-11 21:19 ` Stephen Boyd
  1 sibling, 2 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2018-01-11  8:08 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Stephen Boyd, Dong Aisheng, Michael Turquette, linux-clk,
	Sascha Hauer

On Wed, Jan 10, 2018 at 09:29:02PM -0200, Fabio Estevam wrote:
> Hi,
> 
> Bootling linux-next 20180110 on a imx53-qsb leads to the following
> warning that gets repeated several times:
> 
> 
> [    2.776154] ------------[ cut here ]------------
> [    2.780909] WARNING: CPU: 0 PID: 1 at ../drivers/clk/clk.c:802 clk_core_disable+0xc4/0xe0

that's:

	static void clk_core_disable(struct clk_core *core)
	{
		...
		if (WARN_ON(core->enable_count == 0))
			return;


> [    2.789107] Modules linked in:
> [    2.792198] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc7-next-20180110 #1
> [    2.799696] Hardware name: Freescale i.MX53 (Device Tree Support)
> [    2.805805] Backtrace:
> [    2.808290] [<c010d1a0>] (dump_backtrace) from [<c010d460>] (show_stack+0x18/0x1c)
> [    2.815879]  r7:00000000 r6:60000093 r5:00000000 r4:c1079954
> [    2.821566] [<c010d448>] (show_stack) from [<c0a33bac>] (dump_stack+0xb4/0xe8)
> [    2.828813] [<c0a33af8>] (dump_stack) from [<c0126144>] (__warn+0xf0/0x11c)
> [    2.835795]  r9:00000000 r8:00000322 r7:00000009 r6:c0d425e8 r5:00000000 r4:00000000
> [    2.843558] [<c0126054>] (__warn) from [<c0126288>] (warn_slowpath_null+0x44/0x50)
> [    2.851148]  r8:c1008908 r7:c0e0777c r6:c04be730 r5:00000322 r4:c0d425e8
> [    2.857870] [<c0126244>] (warn_slowpath_null) from [<c04be730>] (clk_core_disable+0xc4/0xe0)
> [    2.866325]  r6:dc02bb00 r5:dc02a980 r4:dc02a980
> [    2.870965] [<c04be66c>] (clk_core_disable) from [<c04bf9e8>] (clk_core_disable_lock+0x20/0x2c)
> [    2.879681]  r5:dc02a980 r4:80000013
> [    2.883278] [<c04bf9c8>] (clk_core_disable_lock) from [<c04bfa18>] (clk_disable+0x24/0x28)
> [    2.891559]  r5:c0f6b3e4 r4:0000001c
> [    2.895160] [<c04bf9f4>] (clk_disable) from [<c0f233b0>] (imx_clk_disable_uart+0x50/0x68)
> [    2.903365] [<c0f23360>] (imx_clk_disable_uart) from [<c010277c>] (do_one_initcall+0x50/0x19c)
> [    2.911996]  r7:c0e0777c r6:c0f63854 r5:c0f23360 r4:ffffe000
> [    2.917678] [<c010272c>] (do_one_initcall) from [<c0f00f00>] (kernel_init_freeable+0x118/0x1d0)
> [    2.926397]  r9:c0f63858 r8:000000f0 r7:c0e0777c r6:c0f63854> r5:c107b540 r4:c0f7525c
> [    2.934169] [<c0f00de8>] (kernel_init_freeable) from [<c0a48ec8>] (kernel_init+0x10/0x118)
> [    2.942456]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0a48eb8
> [    2.950301]  r4:00000000
> [    2.952857] [<c0a48eb8>] (kernel_init) from [<c01010b4>] (ret_from_fork+0x14/0x20)
> [    2.960444] Exception stack(0xdc05dfb0 to 0xdc05dff8)
> [    2.965516] dfa0:                                     00000000 00000000 00000000 00000000
> [    2.973715] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [    2.981912] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [    2.988543]  r5:c0a48eb8 r4:00000000
> [    2.992135] ---[ end trace 5c23aee63f870994 ]---
> [    2.997359] ------------[ cut here ]------------
> 
> Does anyone have any ideas on how to fix it?

Without earlycon or earlyprintk imx_clk_disable_uart is a noop. Does
this also happen when these are not given? Does this also happen when
clk_ignore_unused is on the command line?

My guess is that imx_register_uart_clocks() enables the uart clocks,
clk_disable_unused() then disables the unused ones and
imx_clk_disable_uart() disables them once more.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-11  8:08 ` Uwe Kleine-König
@ 2018-01-11  9:58   ` Lucas Stach
  2018-01-15 12:24   ` Fabio Estevam
  1 sibling, 0 replies; 11+ messages in thread
From: Lucas Stach @ 2018-01-11  9:58 UTC (permalink / raw)
  To: Uwe Kleine-König, Fabio Estevam
  Cc: Dong Aisheng, Michael Turquette, Stephen Boyd, linux-clk,
	Sascha Hauer

Am Donnerstag, den 11.01.2018, 09:08 +0100 schrieb Uwe Kleine-König:
> On Wed, Jan 10, 2018 at 09:29:02PM -0200, Fabio Estevam wrote:
> > Hi,
> > 
> > Bootling linux-next 20180110 on a imx53-qsb leads to the following
> > warning that gets repeated several times:
> > 
> > 
> > [    2.776154] ------------[ cut here ]------------
> > [    2.780909] WARNING: CPU: 0 PID: 1 at ../drivers/clk/clk.c:802
> > clk_core_disable+0xc4/0xe0
> 
> that's:
> 
> 	static void clk_core_disable(struct clk_core *core)
> 	{
> 		...
> 		if (WARN_ON(core->enable_count == 0))
> 			return;
> 
> 
> > [    2.789107] Modules linked in:
> > [    2.792198] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-
> > rc7-next-20180110 #1
> > [    2.799696] Hardware name: Freescale i.MX53 (Device Tree
> > Support)
> > [    2.805805] Backtrace:
> > [    2.808290] [<c010d1a0>] (dump_backtrace) from [<c010d460>]
> > (show_stack+0x18/0x1c)
> > [    2.815879]  r7:00000000 r6:60000093 r5:00000000 r4:c1079954
> > [    2.821566] [<c010d448>] (show_stack) from [<c0a33bac>]
> > (dump_stack+0xb4/0xe8)
> > [    2.828813] [<c0a33af8>] (dump_stack) from [<c0126144>]
> > (__warn+0xf0/0x11c)
> > [    2.835795]  r9:00000000 r8:00000322 r7:00000009 r6:c0d425e8
> > r5:00000000 r4:00000000
> > [    2.843558] [<c0126054>] (__warn) from [<c0126288>]
> > (warn_slowpath_null+0x44/0x50)
> > [    2.851148]  r8:c1008908 r7:c0e0777c r6:c04be730 r5:00000322
> > r4:c0d425e8
> > [    2.857870] [<c0126244>] (warn_slowpath_null) from [<c04be730>]
> > (clk_core_disable+0xc4/0xe0)
> > [    2.866325]  r6:dc02bb00 r5:dc02a980 r4:dc02a980
> > [    2.870965] [<c04be66c>] (clk_core_disable) from [<c04bf9e8>]
> > (clk_core_disable_lock+0x20/0x2c)
> > [    2.879681]  r5:dc02a980 r4:80000013
> > [    2.883278] [<c04bf9c8>] (clk_core_disable_lock) from
> > [<c04bfa18>] (clk_disable+0x24/0x28)
> > [    2.891559]  r5:c0f6b3e4 r4:0000001c
> > [    2.895160] [<c04bf9f4>] (clk_disable) from [<c0f233b0>]
> > (imx_clk_disable_uart+0x50/0x68)
> > [    2.903365] [<c0f23360>] (imx_clk_disable_uart) from
> > [<c010277c>] (do_one_initcall+0x50/0x19c)
> > [    2.911996]  r7:c0e0777c r6:c0f63854 r5:c0f23360 r4:ffffe000
> > [    2.917678] [<c010272c>] (do_one_initcall) from [<c0f00f00>]
> > (kernel_init_freeable+0x118/0x1d0)
> > [    2.926397]  r9:c0f63858 r8:000000f0 r7:c0e0777c r6:c0f63854>
> > r5:c107b540 r4:c0f7525c
> > [    2.934169] [<c0f00de8>] (kernel_init_freeable) from
> > [<c0a48ec8>] (kernel_init+0x10/0x118)
> > [    2.942456]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
> > r6:00000000 r5:c0a48eb8
> > [    2.950301]  r4:00000000
> > [    2.952857] [<c0a48eb8>] (kernel_init) from [<c01010b4>]
> > (ret_from_fork+0x14/0x20)
> > [    2.960444] Exception stack(0xdc05dfb0 to 0xdc05dff8)
> > [    2.965516] dfa0:                                     00000000
> > 00000000 00000000 00000000
> > [    2.973715] dfc0: 00000000 00000000 00000000 00000000 00000000
> > 00000000 00000000 00000000
> > [    2.981912] dfe0: 00000000 00000000 00000000 00000000 00000013
> > 00000000
> > [    2.988543]  r5:c0a48eb8 r4:00000000
> > [    2.992135] ---[ end trace 5c23aee63f870994 ]---
> > [    2.997359] ------------[ cut here ]------------
> > 
> > Does anyone have any ideas on how to fix it?
> 
> Without earlycon or earlyprintk imx_clk_disable_uart is a noop. Does
> this also happen when these are not given? Does this also happen when
> clk_ignore_unused is on the command line?
> 
> My guess is that imx_register_uart_clocks() enables the uart clocks,
> clk_disable_unused() then disables the unused ones

If they are enabled, they are no longer unused.

Regards,
Lucas

> and
> imx_clk_disable_uart() disables them once more.
> 
> Best regards
> Uwe
> 

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-10 23:29 Warnings from drivers/clk/clk.c Fabio Estevam
  2018-01-11  8:08 ` Uwe Kleine-König
@ 2018-01-11 21:19 ` Stephen Boyd
  2018-01-11 21:29   ` Uwe Kleine-König
                     ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Stephen Boyd @ 2018-01-11 21:19 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Sascha Hauer, Dong Aisheng, linux-clk, Michael Turquette

On 01/10, Fabio Estevam wrote:
> Hi,
> 
> Bootling linux-next 20180110 on a imx53-qsb leads to the following
> warning that gets repeated several times:
> 
> 
> [    2.776154] ------------[ cut here ]------------
> [    2.780909] WARNING: CPU: 0 PID: 1 at ../drivers/clk/clk.c:802
> clk_core_disable+0xc4/0xe0

We have two WARN_ON in this function. Do you know which one hit
(makes me think we should put a printk in here now and also
include the clk name).

> [    2.789107] Modules linked in:
> [    2.792198] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
> 4.15.0-rc7-next-20180110 #1
> [    2.799696] Hardware name: Freescale i.MX53 (Device Tree Support)
> [    2.805805] Backtrace:
> [    2.808290] [<c010d1a0>] (dump_backtrace) from [<c010d460>]
> (show_stack+0x18/0x1c)
> [    2.815879]  r7:00000000 r6:60000093 r5:00000000 r4:c1079954
> [    2.821566] [<c010d448>] (show_stack) from [<c0a33bac>]
> (dump_stack+0xb4/0xe8)
> [    2.828813] [<c0a33af8>] (dump_stack) from [<c0126144>] (__warn+0xf0/0x11c)
> [    2.835795]  r9:00000000 r8:00000322 r7:00000009 r6:c0d425e8
> r5:00000000 r4:00000000
> [    2.843558] [<c0126054>] (__warn) from [<c0126288>]
> (warn_slowpath_null+0x44/0x50)
> [    2.851148]  r8:c1008908 r7:c0e0777c r6:c04be730 r5:00000322 r4:c0d425e8
> [    2.857870] [<c0126244>] (warn_slowpath_null) from [<c04be730>]
> (clk_core_disable+0xc4/0xe0)
> [    2.866325]  r6:dc02bb00 r5:dc02a980 r4:dc02a980
> [    2.870965] [<c04be66c>] (clk_core_disable) from [<c04bf9e8>]
> (clk_core_disable_lock+0x20/0x2c)
> [    2.879681]  r5:dc02a980 r4:80000013
> [    2.883278] [<c04bf9c8>] (clk_core_disable_lock) from [<c04bfa18>]
> (clk_disable+0x24/0x28)
> [    2.891559]  r5:c0f6b3e4 r4:0000001c
> [    2.895160] [<c04bf9f4>] (clk_disable) from [<c0f233b0>]
> (imx_clk_disable_uart+0x50/0x68)
> [    2.903365] [<c0f23360>] (imx_clk_disable_uart) from [<c010277c>]
> (do_one_initcall+0x50/0x19c)

Perhaps some critical clk is also in the uart clk list?
Otherwise, there's some sort of imbalance causing a uart clk to
be disabled more than it's been enabled? I don't see any crtical
clk markings in the imx driver, so maybe it's some sort of
improper double disable?

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

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-11 21:19 ` Stephen Boyd
@ 2018-01-11 21:29   ` Uwe Kleine-König
  2018-01-15 12:14   ` Fabio Estevam
  2018-01-15 16:48   ` Fabio Estevam
  2 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2018-01-11 21:29 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Fabio Estevam, Dong Aisheng, Michael Turquette, linux-clk,
	Sascha Hauer

On Thu, Jan 11, 2018 at 01:19:48PM -0800, Stephen Boyd wrote:
> On 01/10, Fabio Estevam wrote:
> > Hi,
> > 
> > Bootling linux-next 20180110 on a imx53-qsb leads to the following
> > warning that gets repeated several times:
> > 
> > 
> > [    2.776154] ------------[ cut here ]------------
> > [    2.780909] WARNING: CPU: 0 PID: 1 at ../drivers/clk/clk.c:802
> > clk_core_disable+0xc4/0xe0
> 
> We have two WARN_ON in this function. Do you know which one hit
> (makes me think we should put a printk in here now and also
> include the clk name).

It's the one in line 802 as noted above :-)
 
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-11 21:19 ` Stephen Boyd
  2018-01-11 21:29   ` Uwe Kleine-König
@ 2018-01-15 12:14   ` Fabio Estevam
  2018-01-15 12:56     ` Fabio Estevam
  2018-01-15 16:48   ` Fabio Estevam
  2 siblings, 1 reply; 11+ messages in thread
From: Fabio Estevam @ 2018-01-15 12:14 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Sascha Hauer, Dong Aisheng, linux-clk, Michael Turquette

Hi Stephen,

On Thu, Jan 11, 2018 at 7:19 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:

> We have two WARN_ON in this function. Do you know which one hit
> (makes me think we should put a printk in here now and also
> include the clk name).

The two WARN_ON() places are hit.

Please see the complete log at:
https://storage.kernelci.org/next/master/next-20180115/arm/imx_v6_v7_defconfig/lab-pengutronix/boot-imx53-qsrb.txt

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-11  8:08 ` Uwe Kleine-König
  2018-01-11  9:58   ` Lucas Stach
@ 2018-01-15 12:24   ` Fabio Estevam
  1 sibling, 0 replies; 11+ messages in thread
From: Fabio Estevam @ 2018-01-15 12:24 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Stephen Boyd, Dong Aisheng, Michael Turquette, linux-clk,
	Sascha Hauer

Hi Uwe,

On Thu, Jan 11, 2018 at 6:08 AM, Uwe Kleine-K=C3=B6nig
<u.kleine-koenig@pengutronix.de> wrote:

> Without earlycon or earlyprintk imx_clk_disable_uart is a noop. Does
> this also happen when these are not given? Does this also happen when
> clk_ignore_unused is on the command line?

Yes, it happens without earlycon or earlyprintk.

The warnings also happens if I pass 'clk_ignore_unused'.

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-15 12:14   ` Fabio Estevam
@ 2018-01-15 12:56     ` Fabio Estevam
  0 siblings, 0 replies; 11+ messages in thread
From: Fabio Estevam @ 2018-01-15 12:56 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Sascha Hauer, Dong Aisheng, linux-clk, Michael Turquette

On Mon, Jan 15, 2018 at 10:14 AM, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Stephen,
>
> On Thu, Jan 11, 2018 at 7:19 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>
>> We have two WARN_ON in this function. Do you know which one hit
>> (makes me think we should put a printk in here now and also
>> include the clk name).
>
> The two WARN_ON() places are hit.
>
> Please see the complete log at:
> https://storage.kernelci.org/next/master/next-20180115/arm/imx_v6_v7_defconfig/lab-pengutronix/boot-imx53-qsrb.txt

Ok, I managed to fix the issue. Will send a patch shortly.

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-11 21:19 ` Stephen Boyd
  2018-01-11 21:29   ` Uwe Kleine-König
  2018-01-15 12:14   ` Fabio Estevam
@ 2018-01-15 16:48   ` Fabio Estevam
  2018-01-16  9:42     ` Geert Uytterhoeven
  2 siblings, 1 reply; 11+ messages in thread
From: Fabio Estevam @ 2018-01-15 16:48 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Sascha Hauer, Dong Aisheng, linux-clk, Michael Turquette

Hi Stephen,

On Thu, Jan 11, 2018 at 7:19 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:

> We have two WARN_ON in this function. Do you know which one hit
> (makes me think we should put a printk in here now and also
> include the clk name).

Yes, having the clk name that causes the warning really helps debugging.

Do you mean like this?

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0f686a9..6fed292 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -681,8 +681,12 @@ static void clk_core_unprepare(struct clk_core *core)
        if (!core)
                return;

-       if (WARN_ON(core->prepare_count == 0))
+       if (core->prepare_count == 0) {
+               pr_err("%s: %s called with enable_count not zero\n",
+                      __func__, core->name);
+               WARN_ON(1);
                return;
+       }

        if (WARN_ON(core->prepare_count == 1 && core->flags & CLK_IS_CRITICAL))
                return;
@@ -808,9 +812,14 @@ static void clk_core_disable(struct clk_core *core)
        if (!core)
                return;

-       if (WARN_ON(core->enable_count == 0))
+       if (core->enable_count == 0) {
+               pr_err("%s: %s called with enable_count not zero\n",
+                      __func__, core->name);
+               WARN_ON(1);
                return;

+       }
+
        if (WARN_ON(core->enable_count == 1 && core->flags & CLK_IS_CRITICAL))
                return;

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-15 16:48   ` Fabio Estevam
@ 2018-01-16  9:42     ` Geert Uytterhoeven
  2018-01-16  9:45       ` Fabio Estevam
  0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2018-01-16  9:42 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Stephen Boyd, Sascha Hauer, Dong Aisheng, linux-clk,
	Michael Turquette

Hi Fabio,

On Mon, Jan 15, 2018 at 5:48 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Thu, Jan 11, 2018 at 7:19 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> We have two WARN_ON in this function. Do you know which one hit
>> (makes me think we should put a printk in here now and also
>> include the clk name).
>
> Yes, having the clk name that causes the warning really helps debugging.
>
> Do you mean like this?
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 0f686a9..6fed292 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -681,8 +681,12 @@ static void clk_core_unprepare(struct clk_core *core)
>         if (!core)
>                 return;
>
> -       if (WARN_ON(core->prepare_count == 0))
> +       if (core->prepare_count == 0) {
> +               pr_err("%s: %s called with enable_count not zero\n",
> +                      __func__, core->name);
> +               WARN_ON(1);
>                 return;
> +       }

I believe you can just replace WARN_ON() by WARN(condition, format...)?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: Warnings from drivers/clk/clk.c
  2018-01-16  9:42     ` Geert Uytterhoeven
@ 2018-01-16  9:45       ` Fabio Estevam
  0 siblings, 0 replies; 11+ messages in thread
From: Fabio Estevam @ 2018-01-16  9:45 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Stephen Boyd, Sascha Hauer, Dong Aisheng, linux-clk,
	Michael Turquette

Hi Geert,

On Tue, Jan 16, 2018 at 7:42 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:

> I believe you can just replace WARN_ON() by WARN(condition, format...)?

Yes, this looks nicer. Thanks for the hint!

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

end of thread, other threads:[~2018-01-16  9:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 23:29 Warnings from drivers/clk/clk.c Fabio Estevam
2018-01-11  8:08 ` Uwe Kleine-König
2018-01-11  9:58   ` Lucas Stach
2018-01-15 12:24   ` Fabio Estevam
2018-01-11 21:19 ` Stephen Boyd
2018-01-11 21:29   ` Uwe Kleine-König
2018-01-15 12:14   ` Fabio Estevam
2018-01-15 12:56     ` Fabio Estevam
2018-01-15 16:48   ` Fabio Estevam
2018-01-16  9:42     ` Geert Uytterhoeven
2018-01-16  9:45       ` Fabio Estevam

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.