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: 10236869 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 D9FAE602DC for ; Fri, 23 Feb 2018 04:08:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D874D29163 for ; Fri, 23 Feb 2018 04:08:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCFF629271; Fri, 23 Feb 2018 04:08:40 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 4FCFB29163 for ; Fri, 23 Feb 2018 04:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbeBWEIj (ORCPT ); Thu, 22 Feb 2018 23:08:39 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:37870 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751296AbeBWEIi (ORCPT ); Thu, 22 Feb 2018 23:08:38 -0500 Received: by mail-pl0-f65.google.com with SMTP id ay8so4209234plb.4 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=lyrIyTdq3chOgDE5ky537zFgg5GdTsrTXvTM2FssdHgBjGhLYP+6YGM+3wy+AhsLmX XY/SpQg2xTtyCWjDGZi5y6rff9hmLRNjy+MmJNAAxGVjwUVzBfRBismxu51mboqLKHus x1SKRwmauQeHv+rVFasQNG2iJuvGNhC7lxNv0pLC7rYe4YyiDaD+lBjd8vMwCjyOm6dG 5EDYtUe8XJd4q8fjRKngboj6JodqFKytLADOQtLo3ohaIM3kXVMSXF9Xyr5OQ2GhP0xB SCEeT6UOqE5hFUQQdeqhWYpnnsY/IvgrfVtFcJdBVASjAj2mmuA3qrXtos4m21j6iC8+ j0EQ== X-Gm-Message-State: APf1xPDEQMHIJxsQkIJR6MI3H2F1fCVv67EkPWL5EyS954J8PyCFqJPN Oemz1VKL105Pf0896UKvX6u4Dg== 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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)