From patchwork Thu Oct 31 10:36:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3120011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7F86E9F431 for ; Thu, 31 Oct 2013 10:45:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4410A203E6 for ; Thu, 31 Oct 2013 10:45:53 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D88B203DC for ; Thu, 31 Oct 2013 10:45:52 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbpl2-0003cA-Vf; Thu, 31 Oct 2013 10:45:45 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbpl0-000501-Fx; Thu, 31 Oct 2013 10:45:42 +0000 Received: from mail-bk0-f45.google.com ([209.85.214.45]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbpkv-0004zd-1O for linux-arm-kernel@lists.infradead.org; Thu, 31 Oct 2013 10:45:40 +0000 Received: by mail-bk0-f45.google.com with SMTP id r7so912504bkg.32 for ; Thu, 31 Oct 2013 03:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=Q1/OtXz/V9aSV2VsNvyp942RPyTobp9lO11CZc+4W7o=; b=vgkegAN+L6PjHyOQqtkOOAtZdYHBbplGTsgv2vMwj6UiCRvmBOKfAOYNl09p0QjzJv 8VMbTGseoyoaoNGqDjtBNY6ZBnhfgeZPqX+FWPYjg4mj9DG+/NeydxdrhadVyIRW8QiU w55eKKJurRIQOHIFFjtYKeeg6klBezUaCjtVVkf3WhZVe5XcyqDduIPWf2oygYqwu5id a58/kE1K8uFvwsUcYCFx0lhJaJ3Bsgqj8dzLjxz/mKfthPWsgZWiGgWsnefWZg+s3ssQ 0vx836Lg39BbRxYrp/5SviQpGpmbKFH0AG8TCYIv8ufNn3EFpr9eDdS9/YiLM26ZXd1g W9TQ== MIME-Version: 1.0 X-Received: by 10.204.69.12 with SMTP id x12mr1375825bki.12.1383215820022; Thu, 31 Oct 2013 03:37:00 -0700 (PDT) Received: by 10.205.19.10 with HTTP; Thu, 31 Oct 2013 03:36:59 -0700 (PDT) Date: Thu, 31 Oct 2013 18:36:59 +0800 Message-ID: Subject: [PATCH -next] clk: keystone: fix return value check in _of_pll_clk_init() From: Wei Yongjun To: mturquette@linaro.org, santosh.shilimkar@ti.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131031_064537_209540_E11AEFC9 X-CRM114-Status: GOOD ( 11.61 ) X-Spam-Score: -2.7 (--) Cc: yongjun_wei@trendmicro.com.cn, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun clk_register_pll() returns ERR_PTR() when memory alloc fail and NULL in the other case, the user of this function should used IS_ERR_OR_NULL() to check the return value. this patch change clk_register_pll() to return only ERR_PTR(), and also fixed the user. Signed-off-by: Wei Yongjun --- drivers/clk/keystone/pll.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c index 47a1bd9..78a6e0e 100644 --- a/drivers/clk/keystone/pll.c +++ b/drivers/clk/keystone/pll.c @@ -127,12 +127,9 @@ static struct clk *clk_register_pll(struct device *dev, clk = clk_register(NULL, &pll->hw); if (IS_ERR(clk)) - goto out; + kfree(pll); return clk; -out: - kfree(pll); - return NULL; } /** @@ -182,7 +179,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; }