From patchwork Wed May 17 06:50:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9730089 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 2793F60363 for ; Wed, 17 May 2017 06:52:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17EC1286EB for ; Wed, 17 May 2017 06:52:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C077286FE; Wed, 17 May 2017 06:52:07 +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 A7EE3286EB for ; Wed, 17 May 2017 06:52:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752232AbdEQGwF (ORCPT ); Wed, 17 May 2017 02:52:05 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36414 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752894AbdEQGwF (ORCPT ); Wed, 17 May 2017 02:52:05 -0400 Received: by mail-pf0-f195.google.com with SMTP id n23so625309pfb.3; Tue, 16 May 2017 23:51:54 -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=DbGXxEf/z8Hksj7/SooVXRo9HDb2wzvIQU19ZRw+3cg=; b=T2CmglBIaExh9wfoiZ/w8bs06XB17PW3YjvGAs1K2LLyphgpdPnNeF0+Q7zve8mcAm 1ZYAiVUYV3IVRccl1Ai21OgNy8brsIVdNpQ6OWbyUdWVja2g9NkPaOXZhCSeWvejgvSq 2kl4C0YjbYWUHacbWI/IDjdNCvk2131GnlFJf3s6QWuiq6mxH3Q7S0kqamnxWeylKsdy G3JjIij/cgb1mQY4mpjUE3qC+3cC3aVCT1mNAerzvhMt3YlKWB9R1HT2AXN9aIscKEpg HpRIIwBzPdAP5Ni2zuOWpFp2IhmDhZDfK0wQTNZPkH10XXIxcxeoRadmJXA4VLyvJOGh GSAQ== 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=DbGXxEf/z8Hksj7/SooVXRo9HDb2wzvIQU19ZRw+3cg=; b=MjIIpSemWXrBpi0IjLgfQrgH14tsEAeOCd/1XqsKSKd6xXs3xjze0ZUZKdO9jbiyF5 0CsHv4ADyJihDi7wRL6lxfhxqwR8meotf0qvdq/2jTCuuKrEw3BoXnSSH/oEKFzcIgvm H6G+tQiO2lR7hDChzV74DK8lA9K+sKmKXsYRXfEsdpvplvuclX0HBnddUTjfcP6o4kvg MqZF1VlXtDy+XmiXED6YAzVlGa5JnbxIV9OoSGacgDliUZsJ3fa8WAJy3T915HxrYTdy EoA4iVU/pLGU9xYUM1/yQ6ijb2kFfnvnAfKJFauhgXp5MASBREoJjEWPHufzMHujVjyO MFoQ== X-Gm-Message-State: AODbwcArNQn8eNohGCuyp+u4YL+CW3NxOVJlaHK+jkdjDF+V7N6SYA2Y ICGsM2STCEgm1bCg X-Received: by 10.98.200.142 with SMTP id i14mr2177755pfk.154.1495003914170; Tue, 16 May 2017 23:51:54 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id q64sm2059873pfi.69.2017.05.16.23.51.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 23:51:53 -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 v3] cpufreq: kirkwood-cpufreq:- Handle return value of clk_prepare_enable Date: Wed, 17 May 2017 12:20:35 +0530 Message-Id: <1495003835-25828-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 clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav Acked-by: Viresh Kumar --- 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;