From patchwork Wed May 17 06:42:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9730081 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 813C560363 for ; Wed, 17 May 2017 06:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6842B28671 for ; Wed, 17 May 2017 06:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C709286FC; Wed, 17 May 2017 06:44:10 +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 D5D9E28671 for ; Wed, 17 May 2017 06:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752038AbdEQGoH (ORCPT ); Wed, 17 May 2017 02:44:07 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33369 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752023AbdEQGoG (ORCPT ); Wed, 17 May 2017 02:44:06 -0400 Received: by mail-pf0-f195.google.com with SMTP id f27so616525pfe.0; Tue, 16 May 2017 23:44:06 -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=C1FrC9CjFwC6gB0SCjhLsD2ahEa8sIfAbDzcy8RK+A4=; b=WoKt5tBAeJvwS/I4B4XuRD49J0jf+Li+s0NO+0AjQsk+5bvmu+BrcfCisFrXNiTxuH fNMXhGtf/AqYqymwaw6yNamjauSXnXzE6P4pas4kex55qhwIyHnRNeL84D2ew49JTkXY TB8OmZ7+ArD7A7HHoYdFrz7LPWHTaOU537henMGD3UYf8OzMDvokS6YSCz7NQAyEjeEe 7o2GVJwGO5kFkU5nMjHWEoUhEZWVdzIr3ROc4F+61uAeie2xaTaqiJJzJ/WZQvUC+61z yptNWDfKPdG84zptrlOJ/Gz0WJxD59jCoyr6mztQlATowUQ0AYpiFsOJh7S794C4gkO6 Fl3Q== 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=C1FrC9CjFwC6gB0SCjhLsD2ahEa8sIfAbDzcy8RK+A4=; b=UZMYd3C/fb5o6fLoHku09xEEE9bBsobda6aoszf4l0miorLil/WB3xm35TEgMBaWPM yWbRB51dl/tQ4cDYC5rKfG2VTRX5VDzPGQBsBdC0EmC9P281f97vcNZB/VOrXUGbeONL LGFsJ7qRrN05hoTsrSUaLIk+W8j0tfkK1D/ogiDAbgVd9lPIzpCS2s2rptt5m26B+0Cl jQM0nYXW8rawH17rchG4JGhDAY9903JcCqnq2f9fMQ3me8cabzI5+AtBCnKG5HzzCQOi rP7omQljvAMFNvmHEgYhjQXMJEYWPas00pik+x1SZYw0sHghKscx5/VXp5jWqrlOpTQg NHWA== X-Gm-Message-State: AODbwcArzZIg4ZiLbFC0Sg0jNUUfYbVQfVjkeXgJWCqSgw9i4xId5fDL u9fIfUgF44viWA== X-Received: by 10.99.44.9 with SMTP id s9mr2187637pgs.72.1495003445835; Tue, 16 May 2017 23:44:05 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id e20sm1906726pfd.34.2017.05.16.23.44.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 23:44:05 -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 v2] cpufreq: kirkwood-cpufreq:- Handle return value of clk_prepare_enable Date: Wed, 17 May 2017 12:12:38 +0530 Message-Id: <1495003358-25593-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 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c index 1b9bcd7..c2dd43f 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"); @@ -146,7 +155,11 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) err = PTR_ERR(priv.powersave_clk); goto out_ddr; } - clk_prepare_enable(priv.powersave_clk); + err = clk_prepare_enable(priv.powersave_clk); + if (err) { + dev_err(priv.dev, "Unable to prepare powersave clk\n"); + goto out_ddr; + } of_node_put(np); np = NULL;