From patchwork Thu Apr 25 12:30:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 2488251 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 545E23FD85 for ; Thu, 25 Apr 2013 12:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752370Ab3DYMc5 (ORCPT ); Thu, 25 Apr 2013 08:32:57 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:31373 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755325Ab3DYMc4 (ORCPT ); Thu, 25 Apr 2013 08:32:56 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MLT003XW9IGL1S0@mailout2.samsung.com>; Thu, 25 Apr 2013 21:32:52 +0900 (KST) X-AuditID: cbfee61a-b7fd56d0000022fd-3e-517922748ce3 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 75.1E.08957.47229715; Thu, 25 Apr 2013 21:32:52 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MLT00FFR9FCKK30@mmp2.samsung.com>; Thu, 25 Apr 2013 21:32:52 +0900 (KST) From: Lukasz Majewski To: Kukjin Kim Cc: "devicetree-discuss@lists.ozlabs.org" , Zhang Rui , "linux-samsung-soc@vger.kernel.org" , Linux PM list , Amit Daniel Kachhap , Lukasz Majewski , t.figa@samsung.com, Sachin Kamat , Myungjoo Ham , Kyungmin Park Subject: [PATCH v2 4/4] ARM:TMU:fix: Avoid lockup when first frequency table entry is CPUFREQ_ENTRY_INVALID Date: Thu, 25 Apr 2013 14:30:45 +0200 Message-id: <1366893045-31586-5-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1366893045-31586-1-git-send-email-l.majewski@samsung.com> References: <1366389493-8239-1-git-send-email-l.majewski@samsung.com> <1366893045-31586-1-git-send-email-l.majewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsVy+t9jQd0SpcpAg9snVSyWPJjCaHFg9kNW i94FV9kszja9Ybd483Azo8Xn3iOMFjPO72OyuN24gs3iycM+NouTf3oZLdbPeM3iwO2xeM9L Jo871/aweZyfsZDRo2/LKkaPz5vkAlijuGxSUnMyy1KL9O0SuDLO3L/BXNDGVTFpxz6WBsap HF2MnBwSAiYS2xq2MUPYYhIX7q1n62Lk4hASmM4o8X3BfiaQhJBAF5PE6YWuIDabgJ7E57tP weIiAmoSPYu3MoI0MAvcYZb41NzIApIQFsiVeDS3BayIRUBV4sz1HlYQm1fATWLd7NtMENvk JZ7e72MDsTkF3CV2vupmh9jcxCjx+ctTpgmMvAsYGVYxiqYWJBcUJ6XnGuoVJ+YWl+al6yXn 525iBAfgM6kdjCsbLA4xCnAwKvHwCrwqDxRiTSwrrsw9xCjBwawkwrtEvjJQiDclsbIqtSg/ vqg0J7X4EKM0B4uSOO+BVutAIYH0xJLU7NTUgtQimCwTB6dUA+M5p5zA4vAVL08e+Ric3MCp 8M455NnM0qtdSXcyF7rr7S32YPUTuGijmrzMs/FBfaDb0k0hosc+Owu7dIQHlclm967WPvj+ nPSabpN+FeYlN6Z92K5a4czEbM234c/bE8aif9yWRmp9XVGScFEr49Aj58t9nTs9P2R5hatf bFL/mzlzdcuMOUosxRmJhlrMRcWJAFZHQAI8AgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org With the while loop, when i=0 and first entry in the frequency table is CPUFREQ_ENTRY_INVALID, the code results in an endless loop (since i is not incremented). To fix this problem the for loop has been chosen. Incrementing i in the for end block solves the problem. Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park --- Changes for v2: - New in v2 --- drivers/thermal/cpu_cooling.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 8dc44cb..df79f5e8 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -124,7 +124,7 @@ static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level) if (!table) return ret; - while (table[i].frequency != CPUFREQ_TABLE_END) { + for (; table[i].frequency != CPUFREQ_TABLE_END; i++) { if (table[i].frequency == CPUFREQ_ENTRY_INVALID) continue; @@ -138,7 +138,6 @@ static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level) /*return if level matched and table in descending order*/ if (descend && i == level) return table[i].frequency; - i++; } i--;