@@ -122,6 +122,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
122122{
123123 struct idle_statedata * cx = state_ptr + index ;
124124 u32 mpuss_can_lose_context = 0 ;
125+ int error ;
125126
126127 /*
127128 * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -159,7 +160,9 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
159160 * Call idle CPU PM enter notifier chain so that
160161 * VFP and per CPU interrupt context is saved.
161162 */
162- cpu_pm_enter ();
163+ error = cpu_pm_enter ();
164+ if (error )
165+ goto cpu_pm_out ;
163166
164167 if (dev -> cpu == 0 ) {
165168 pwrdm_set_logic_retst (mpu_pd , cx -> mpu_logic_state );
@@ -169,13 +172,17 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
169172 * Call idle CPU cluster PM enter notifier chain
170173 * to save GIC and wakeupgen context.
171174 */
172- if (mpuss_can_lose_context )
173- cpu_cluster_pm_enter ();
175+ if (mpuss_can_lose_context ) {
176+ error = cpu_cluster_pm_enter ();
177+ if (error )
178+ goto cpu_cluster_pm_out ;
179+ }
174180 }
175181
176182 omap4_enter_lowpower (dev -> cpu , cx -> cpu_state );
177183 cpu_done [dev -> cpu ] = true;
178184
185+ cpu_cluster_pm_out :
179186 /* Wakeup CPU1 only if it is not offlined */
180187 if (dev -> cpu == 0 && cpumask_test_cpu (1 , cpu_online_mask )) {
181188
@@ -197,19 +204,20 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
197204 }
198205 }
199206
200- /*
201- * Call idle CPU PM exit notifier chain to restore
202- * VFP and per CPU IRQ context.
203- */
204- cpu_pm_exit ();
205-
206207 /*
207208 * Call idle CPU cluster PM exit notifier chain
208209 * to restore GIC and wakeupgen context.
209210 */
210211 if (dev -> cpu == 0 && mpuss_can_lose_context )
211212 cpu_cluster_pm_exit ();
212213
214+ /*
215+ * Call idle CPU PM exit notifier chain to restore
216+ * VFP and per CPU IRQ context.
217+ */
218+ cpu_pm_exit ();
219+
220+ cpu_pm_out :
213221 tick_broadcast_exit ();
214222
215223fail :
0 commit comments