From: Magnus Damm Date: Wed, 9 Nov 2011 23:44:10 +0000 (+0100) Subject: PM / Clocks: Only disable enabled clocks in pm_clk_suspend() X-Git-Tag: v3.12-rc1~4401^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24050956e029a9ecff096e1992869ada4492963c;p=kernel%2Fkernel-generic.git PM / Clocks: Only disable enabled clocks in pm_clk_suspend() Refrain from running clk_disable() on clocks that have not been enabled. A typical case when this can happen is during Suspend-to-RAM for devices that have no driver associated with them. In such case the clock may be in default ACQUIRED state. Without this patch the sh7372 Mackerel board crashes in __clk_disable() during Suspend-to-RAM with: "Trying to disable clock 0xdeadbeef with 0 usecount" This happens for the CEU device which is added during boot. The test case has no CEU driver included in the kernel configuration. Needed for v3.2-rc1. Signed-off-by: Magnus Damm Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 5f0f85d..428e55e 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -229,7 +229,8 @@ int pm_clk_suspend(struct device *dev) list_for_each_entry_reverse(ce, &psd->clock_list, node) { if (ce->status < PCE_STATUS_ERROR) { - clk_disable(ce->clk); + if (ce->status == PCE_STATUS_ENABLED) + clk_disable(ce->clk); ce->status = PCE_STATUS_ACQUIRED; } }