From patchwork Tue May 16 07:11:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9728421 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 5733C602B4 for ; Tue, 16 May 2017 07:13:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48DC52862B for ; Tue, 16 May 2017 07:13:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C79A289F6; Tue, 16 May 2017 07:13:21 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 E7C182862B for ; Tue, 16 May 2017 07:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751156AbdEPHNT (ORCPT ); Tue, 16 May 2017 03:13:19 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36826 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbdEPHNS (ORCPT ); Tue, 16 May 2017 03:13:18 -0400 Received: by mail-pg0-f68.google.com with SMTP id h64so15576316pge.3; Tue, 16 May 2017 00:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hvpsHU0CSjqD8UEDV4zLfFXemjunZ3dI7qJCR6lf+PA=; b=iVYY4G78g7AWWCDCNyUHkdKEoTrWYwu7+bVVBmtPnVwGKQHhtCVXsMWr7tj6iVoje+ ngR8IKYz0OSaAJ7wlIn77kFBGchm6CNKYrRdSZf73RywRAPvOpAFk056UjJE7IoYnLrd vj6JggpKJG5/4zyywKUhSyL52fcbBtccgtBftSXhCqISg3q6eGoQixp0tSTuVvrz68zg j8QMl/Le8/HLSznsENYXjsz10CFi91UuQ0YjxWwaqPOMHbr/AWa3IcIVabAAVbw+2zhd Wsl6RP5ITWL9QhOqtCyqir9dNE/sJYtgVM0BWHDLJjOJHffrEU9aBpSPibG1nfPIAmkm wYkA== 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=hvpsHU0CSjqD8UEDV4zLfFXemjunZ3dI7qJCR6lf+PA=; b=tfZNVjA7PWT4nOFckKbuEUh6+YAlqFKdIVSl7UWoRxLBJDsdCaeLI2Mk9vQDQqMyeC YBVd+WoWvm/+vg/UdKYbXHmFd0r4XmGnqS5FMioymRM47w8ztK3YUbQ7dZPrc52Tzujc g3xApFckg9UKtFvjuqwqkDBy0LzS6U7zlIkjfYLZymJOsxTwIOPd9Fc4nimHMZbq+btc SQ8oDbJnWM4BtklHxozCmEVlPI0gfbFCSOa+P3GP+HUgLEwcNlqjBFx1aeq31/6E2KF7 mv1Z9MDCorZZcjp3F4ZvHO8KtkYqOBYK7oJT2ucPp4cnzq+HtKEBM7HXxNfIHv+cynDt Ss9Q== X-Gm-Message-State: AODbwcCMV2jLBu+XmOzKoJ8NrSf28OTAPVh4Y8aTGxIFSq+12jR6qDXr iLstvR0u3A9KnYao X-Received: by 10.84.196.164 with SMTP id l33mr13957342pld.0.1494918798065; Tue, 16 May 2017 00:13:18 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id d83sm24685948pfe.40.2017.05.16.00.13.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 00:13:17 -0700 (PDT) From: Arvind Yadav To: rjw@rjwysocki.net, viresh.kumar@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] cpufreq: kirkwood-cpufreq:- Handle return value of clk_prepare_enable Date: Tue, 16 May 2017 12:41:57 +0530 Message-Id: <1494918717-16434-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 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 Here, Clock enable can failed. So adding an error check for clk_prepare_enable. Signed-off-by: Arvind Yadav --- drivers/cpufreq/kirkwood-cpufreq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c index 1b9bcd7..4c30103 100644 --- a/drivers/cpufreq/kirkwood-cpufreq.c +++ b/drivers/cpufreq/kirkwood-cpufreq.c @@ -127,7 +127,12 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) return PTR_ERR(priv.cpu_clk); } - clk_prepare_enable(priv.cpu_clk); + err = clk_prepare_enable(priv.cpu_clk); + if (err) { + dev_err(priv.dev, "Unable to prepare cpuclk\n"); + return err; + } + kirkwood_freq_table[0].frequency = clk_get_rate(priv.cpu_clk) / 1000; priv.ddr_clk = of_clk_get_by_name(np, "ddrclk"); @@ -137,7 +142,11 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) goto out_cpu; } - clk_prepare_enable(priv.ddr_clk); + err = clk_prepare_enable(priv.ddr_clk); + if (err) { + dev_err(priv.dev, "Unable to prepare ddrclk\n"); + goto out_cpu; + } kirkwood_freq_table[1].frequency = clk_get_rate(priv.ddr_clk) / 1000; priv.powersave_clk = of_clk_get_by_name(np, "powersave");