From mboxrd@z Thu Jan 1 00:00:00 1970 From: tomeu.vizoso@collabora.com (Tomeu Vizoso) Date: Fri, 16 Sep 2016 07:59:02 +0200 Subject: [PATCH] soc: rockchip: power-domain: Handle errors from of_genpd_add_provider_onecell In-Reply-To: <6250295.kzQYkblnJM@diego> References: <1473936221-9248-1-git-send-email-tomeu.vizoso@collabora.com> <14744126.0kYUlUJ0mc@diego> <6250295.kzQYkblnJM@diego> Message-ID: <4f94a0bf-921c-cacb-a035-8111a969d156@collabora.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 09/16/2016 12:31 AM, Heiko St?bner wrote: > Am Donnerstag, 15. September 2016, 16:39:34 schrieb Heiko St?bner: >> Am Donnerstag, 15. September 2016, 12:43:41 schrieb Tomeu Vizoso: >>> It was a bit surprising that the device was reported to have probed just >>> fine, but the provider hadn't been registered. >>> >>> So handle any errors when registering the provider and fail the probe >>> accordingly. >>> >>> Signed-off-by: Tomeu Vizoso >>> Cc: Caesar Wang >>> --- >>> >>> drivers/soc/rockchip/pm_domains.c | 6 +++++- >>> 1 file changed, 5 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/soc/rockchip/pm_domains.c >>> b/drivers/soc/rockchip/pm_domains.c index 7acd1517dd37..57e920128cb2 >>> 100644 >>> --- a/drivers/soc/rockchip/pm_domains.c >>> +++ b/drivers/soc/rockchip/pm_domains.c >>> @@ -627,7 +627,11 @@ static int rockchip_pm_domain_probe(struct >>> platform_device *pdev) goto err_out; >>> >>> } >>> >>> - of_genpd_add_provider_onecell(np, &pmu->genpd_data); >>> + error = of_genpd_add_provider_onecell(np, &pmu->genpd_data); >>> + if (error) { >>> + dev_err(dev, "failed to add provider: %d\n", error); >>> + goto err_out; >>> + } >>> >>> return 0; >> >> Looks good in itself, but seems to trigger some issue in the genpd code >> when applied alone on top of linux-next-20160915. Looks like genpd >> is missing counter-initialization somewhere, as I'm seeing now: >> >> [ 1.664744] genpd_poweroff_unused disabling (null) >> [ 1.669553] ------------[ cut here ]------------ >> [ 1.674169] WARNING: CPU: 0 PID: 1 at ../kernel/workqueue.c:1440 >> __queue_work+0x2b8/0x3f8 [ 1.682337] Modules linked in: >> [ 1.685401] CPU: 0 PID: 1 Comm: swapper/0 Not tainted >> 4.8.0-rc6-next-20160915-00001-g7432710-dirty #5 [ 1.694608] Hardware >> name: Rockchip (Device Tree) >> [ 1.699312] [] (unwind_backtrace) from [] >> (show_stack+0x10/0x14) [ 1.707050] [] (show_stack) from >> [] (dump_stack+0x90/0xa4) [ 1.714267] [] >> (dump_stack) from [] (__warn+0xe8/0x100) [ 1.721221] >> [] (__warn) from [] (warn_slowpath_null+0x20/0x28) [ >> 1.728785] [] (warn_slowpath_null) from [] >> (__queue_work+0x2b8/0x3f8) [ 1.737041] [] (__queue_work) from >> [] (queue_work_on+0x40/0x4c) [ 1.744692] [] >> (queue_work_on) from [] (genpd_poweroff_unused+0x78/0x9c) [ >> 1.753123] [] (genpd_poweroff_unused) from [] >> (do_one_initcall+0x40/0x170) [ 1.761815] [] (do_one_initcall) >> from [] (kernel_init_freeable+0x15c/0x1fc) [ 1.770507] >> [] (kernel_init_freeable) from [] >> (kernel_init+0x8/0x114) [ 1.778678] [] (kernel_init) from >> [] (ret_from_fork+0x14/0x3c) [ 1.786240] ---[ end trace >> b38c51ace1463add ]--- >> [ 1.790875] genpd_poweroff_unused disabling ?????? >> [ 1.795856] genpd_poweroff_unused disabling ?????? >> [ 1.800830] ------------[ cut here ]------------ >> [ 1.805443] WARNING: CPU: 0 PID: 1 at ../kernel/workqueue.c:1440 >> __queue_work+0x2b8/0x3f8 [ 1.813610] Modules linked in: >> [ 1.816673] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W >> 4.8.0-rc6-next-20160915-00001-g7432710-dirty #5 [ 1.827094] Hardware >> name: Rockchip (Device Tree) >> [ 1.831795] [] (unwind_backtrace) from [] >> (show_stack+0x10/0x14) [ 1.839532] [] (show_stack) from >> [] (dump_stack+0x90/0xa4) [ 1.846747] [] >> (dump_stack) from [] (__warn+0xe8/0x100) [ 1.853700] >> [] (__warn) from [] (warn_slowpath_null+0x20/0x28) [ >> 1.861264] [] (warn_slowpath_null) from [] >> (__queue_work+0x2b8/0x3f8) [ 1.869521] [] (__queue_work) from >> [] (queue_work_on+0x40/0x4c) [ 1.877170] [] >> (queue_work_on) from [] (genpd_poweroff_unused+0x78/0x9c) [ >> 1.885600] [] (genpd_poweroff_unused) from [] >> (do_one_initcall+0x40/0x170) [ 1.894290] [] (do_one_initcall) >> from [] (kernel_init_freeable+0x15c/0x1fc) [ 1.902981] >> [] (kernel_init_freeable) from [] >> (kernel_init+0x8/0x114) [ 1.911152] [] (kernel_init) from >> [] (ret_from_fork+0x14/0x3c) [ 1.918713] ---[ end trace >> b38c51ace1463ade ]--- >> [ 1.923338] genpd_poweroff_unused disabling ?????? >> [ 1.928325] genpd_poweroff_unused disabling ?????? >> >> [+ millions more of those] > > just for completenes sake, I've included your patch in a series of my > own [0] which adds the necessary pm_genpd_remove prequisite to prevent > the errors shown above. That's awesome, thanks. For some reason I hadn't noticed those. Regards, Tomeu > > Heiko > > [0] "[PATCH 0/2] soc: rockchip: fix probe error path in power-domain driver" >