From patchwork Wed Dec 17 15:51:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 5507651 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C4FB7BEEA8 for ; Wed, 17 Dec 2014 15:52:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D4CD20A26 for ; Wed, 17 Dec 2014 15:52:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D310209D3 for ; Wed, 17 Dec 2014 15:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751165AbaLQPwj (ORCPT ); Wed, 17 Dec 2014 10:52:39 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:44465 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751392AbaLQPvk (ORCPT ); Wed, 17 Dec 2014 10:51:40 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id sBHFpaiO006726; Wed, 17 Dec 2014 09:51:36 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id sBHFpaoA028698; Wed, 17 Dec 2014 09:51:36 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 17 Dec 2014 09:51:36 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id sBHFpakj010480; Wed, 17 Dec 2014 09:51:36 -0600 From: Nishanth Menon To: Viresh Kumar , "Rafael J. Wysocki" CC: , , Nishanth Menon Subject: [PATCH] cpufreq: Stop BUGing the system Date: Wed, 17 Dec 2014 09:51:35 -0600 Message-ID: <1418831495-26958-1-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CPUFRreq subsystem is not a system catastrophic failure point. Failures in these cases DONOT need complete system shutdown with BUG. just refuse to let cpufreq function should be good enough. Signed-off-by: Nishanth Menon Acked-by: Kevin Hilman --- drivers/cpufreq/cpufreq.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a09a29c..a5aa2fa 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -281,7 +281,10 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) static void __cpufreq_notify_transition(struct cpufreq_policy *policy, struct cpufreq_freqs *freqs, unsigned int state) { - BUG_ON(irqs_disabled()); + if (irqs_disabled()) { + WARN(1, "IRQs disabled!\n"); + return; + } if (cpufreq_disabled()) return; @@ -1253,9 +1256,12 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) /* * Reaching here after boot in a few seconds may not * mean that system will remain stable at "unknown" - * frequency for longer duration. Hence, a BUG_ON(). + * frequency for longer duration. Hence, a WARN(). */ - BUG_ON(ret); + if (ret) { + WARN(1, "SYSTEM operating at invalid freq %u", policy->cur); + goto err_out_unregister; + } pr_warn("%s: CPU%d: Unlisted initial frequency changed to: %u KHz\n", __func__, policy->cpu, policy->cur); } @@ -2556,7 +2562,10 @@ static int __init cpufreq_core_init(void) return -ENODEV; cpufreq_global_kobject = kobject_create(); - BUG_ON(!cpufreq_global_kobject); + if (!cpufreq_global_kobject) { + WARN(1, "No memory for cpufreq_global_kobject\n"); + return -ENOMEM; + } return 0; }