From patchwork Mon Oct 24 20:43:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9393235 X-Patchwork-Delegate: sboyd@codeaurora.org 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 BC3B76077A for ; Mon, 24 Oct 2016 20:44:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADBE32574A for ; Mon, 24 Oct 2016 20:44:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2616288CD; Mon, 24 Oct 2016 20:44:18 +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.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, 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 16DA82574A for ; Mon, 24 Oct 2016 20:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757259AbcJXUoR (ORCPT ); Mon, 24 Oct 2016 16:44:17 -0400 Received: from smtp10.smtpout.orange.fr ([80.12.242.132]:27344 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757539AbcJXUnp (ORCPT ); Mon, 24 Oct 2016 16:43:45 -0400 Received: from localhost.localdomain ([92.140.170.6]) by mwinf5d87 with ME id zYjV1t00A08dmlo03YjeHU; Mon, 24 Oct 2016 22:43:38 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 24 Oct 2016 22:43:38 +0200 X-ME-IP: 92.140.170.6 From: Christophe JAILLET To: lars@metafoo.de, dan.carpenter@oracle.com, ssantosh@kernel.org, mturquette@baylibre.com, sboyd@codeaurora.org Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 1/3] clk: keystone: Fix an error checking Date: Mon, 24 Oct 2016 22:43:24 +0200 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-Antivirus: avast! (VPS 161024-1, 24/10/2016), Outbound message X-Antivirus-Status: Clean Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clk_register_pll() can return ERR_PTR(-ENOMEM) so checking the return value against NULL only is not correct. In order to fix it, update clk_register_pll() to always return an error pointer in case of error and check the return value with IS_ERR. While at it, also fix a tab vs space in the surrounding code. Signed-off-by: Christophe JAILLET --- Un-compiled and un-tested. --- drivers/clk/keystone/pll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c index a26ba2184454..70d6fb2d23bc 100644 --- a/drivers/clk/keystone/pll.c +++ b/drivers/clk/keystone/pll.c @@ -140,7 +140,7 @@ static struct clk *clk_register_pll(struct device *dev, init.parent_names = (parent_name ? &parent_name : NULL); init.num_parents = (parent_name ? 1 : 0); - pll->pll_data = pll_data; + pll->pll_data = pll_data; pll->hw.init = &init; clk = clk_register(NULL, &pll->hw); @@ -150,7 +150,7 @@ static struct clk *clk_register_pll(struct device *dev, return clk; out: kfree(pll); - return NULL; + return clk; } /** @@ -213,7 +213,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) } clk = clk_register_pll(NULL, node->name, parent_name, pll_data); - if (clk) { + if (!IS_ERR(clk)) { of_clk_add_provider(node, of_clk_src_simple_get, clk); return; }