From patchwork Fri Feb 23 04:08:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10236871 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53703602DC for ; Fri, 23 Feb 2018 04:08:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 512BB29163 for ; Fri, 23 Feb 2018 04:08:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45C0029271; Fri, 23 Feb 2018 04:08:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECDAC29163 for ; Fri, 23 Feb 2018 04:08:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751296AbeBWEIk (ORCPT ); Thu, 22 Feb 2018 23:08:40 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:41424 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751435AbeBWEIi (ORCPT ); Thu, 22 Feb 2018 23:08:38 -0500 Received: by mail-pl0-f66.google.com with SMTP id k8so4210930pli.8 for ; Thu, 22 Feb 2018 20:08:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=+nKB3nvkyFOkdAsYHnA998knL/R/v24ySX3IvZlWEBg=; b=OYRYO6q3d7wNsvQvp1VlO6ADSYLD9l65gWefQ4T666ctbcZ0C3sbvA2bdHSqrBRHfH d6a3yXvVu3EgsUzery17hdS9Q8q5KNMDBsJqCr7LppVicaDGZUWAnVdafXXaAYFg+fRi qbqqRZ5uIqIkNDB4jLIAEAazordzHdj+cjwSk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+nKB3nvkyFOkdAsYHnA998knL/R/v24ySX3IvZlWEBg=; b=A1861r1/j+ntcpk1kMgg1cMs034kCqxDTrhtejcbdAv8C+x6Yo6ZUQMz4Y/2YFvD6o 1B54y5K580kLmwfcxAPdaDN/oPwH/3Ahz6+TC9Xc4q5kgJMEY8/aOQ0CA/F4wcuHhj9Q Y3x/34aZYz6OxHltfPNHG+CnhpF7OkZvwpobEyphb1kdKWkW7o89jkJVH7MpZlSzE3Nx nUy5J91aIp2yBGcN2zRS+Mk6yT36Z/mNylpHcQiaJNbi1Wg1kHWv93EgZVsubXOAvOyQ l0qN80bIXjFPZn6GXy/f5pxqK6bBrUkCbANRfwtlT9Qya0r+Gl6cnByp1t8wI0d7cSt+ gWzg== X-Gm-Message-State: APf1xPD8jwfmH8SqUYHzykdr0JqkBQy61l5RcefMLD8NCvrXx+vv7bkQ xZvWZezyFYmg9KH3SLDtqqJjm4/1F5Y= X-Google-Smtp-Source: AH8x227eUq3NBasNYstCSJlXEp1WAve2tyVVZ2sE8RoSoAq8VLZuFe8yRDs5nQd3RXL/0vC8o1AOWg== X-Received: by 2002:a17:902:6184:: with SMTP id u4-v6mr395236plj.390.1519358917543; Thu, 22 Feb 2018 20:08:37 -0800 (PST) Received: from localhost ([122.167.232.138]) by smtp.gmail.com with ESMTPSA id n81sm2682967pfk.152.2018.02.22.20.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 20:08:36 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Kukjin Kim , Krzysztof Kozlowski Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Sylwester Nawrocki , Marek Szyprowski , =?UTF-8?q?Bart=C5=82omiej=20=C5=BBo=C5=82nierkiewicz?= , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: s3c24xx: Fix broken s3c_cpufreq_init() Date: Fri, 23 Feb 2018 09:38:28 +0530 Message-Id: <6b737a9c285840b4b2036fa51b692ee835664ec8.1519358505.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP commit a307a1e6bc0d ("cpufreq: s3c: use cpufreq_generic_init()") accidentally broke cpufreq on s3c2410 and s3c2412. These two platforms don't have a CPU frequency table and used to skip calling cpufreq_table_validate_and_show() for them. But with the above commit, we started calling it unconditionally and that will eventually fail as the frequency table pointer is NULL. Fix this by calling cpufreq_table_validate_and_show() conditionally again. Cc: stable@vger.kernel.org # v3.13+ Fixes: a307a1e6bc0d ("cpufreq: s3c: use cpufreq_generic_init()") Signed-off-by: Viresh Kumar --- drivers/cpufreq/s3c24xx-cpufreq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c index 7b596fa38ad2..6bebc1f9f55a 100644 --- a/drivers/cpufreq/s3c24xx-cpufreq.c +++ b/drivers/cpufreq/s3c24xx-cpufreq.c @@ -351,7 +351,13 @@ struct clk *s3c_cpufreq_clk_get(struct device *dev, const char *name) static int s3c_cpufreq_init(struct cpufreq_policy *policy) { policy->clk = clk_arm; - return cpufreq_generic_init(policy, ftab, cpu_cur.info->latency); + + policy->cpuinfo.transition_latency = cpu_cur.info->latency; + + if (ftab) + return cpufreq_table_validate_and_show(policy, ftab); + + return 0; } static int __init s3c_cpufreq_initclks(void)