From patchwork Wed May 13 06:54:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 6394311 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B6562BEEE1 for ; Wed, 13 May 2015 06:55:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8B4E20426 for ; Wed, 13 May 2015 06:55:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD4902038A for ; Wed, 13 May 2015 06:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753781AbbEMGzR (ORCPT ); Wed, 13 May 2015 02:55:17 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38232 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753843AbbEMGzM (ORCPT ); Wed, 13 May 2015 02:55:12 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NOA003JN0JXXT50@mailout1.w1.samsung.com>; Wed, 13 May 2015 07:55:10 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-43-5552f54d874b Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 42.F8.04846.D45F2555; Wed, 13 May 2015 07:55:09 +0100 (BST) Received: from localhost.localdomain ([10.252.80.64]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NOA00ELI0JC0J80@eusync4.samsung.com>; Wed, 13 May 2015 07:55:09 +0100 (BST) From: Krzysztof Kozlowski To: Tero Kristo , Mike Turquette , Stephen Boyd , linux-omap@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [RFT PATCH 5/8] clk: ti: clk-43xx: Prevent possible ERR_PTR dereference Date: Wed, 13 May 2015 15:54:44 +0900 Message-id: <1431500087-2275-6-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1431500087-2275-1-git-send-email-k.kozlowski@samsung.com> References: <1431500087-2275-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4NV3fr0GhBpM2WVq8fmFo8bHnHqvF 5V1z2CxmL+lnsXg64SKbxY8z3SwWS552sDmwe1zu62XyuHNtD5tH35ZVjB7Hb2xn8vi8SS6A NYrLJiU1J7MstUjfLoEr48P7hWwFi9gqps65ztbAuIC1i5GDQ0LARKLxbkQXIyeQKSZx4d56 NhBbSGApo8SJhYFdjFxA9n9GiSX7tzKDJNgEjCU2L1/CBpIQETjOKLFiTz87SIJZwFDi57s/ YLawQIDE38mTwBpYBFQlFl5bzgKyjFfATWLPtXqIZXISJ49NBruBU8Bd4tI8MRBTCKhiX0Pd BEbeBYwMqxhFU0uTC4qT0nMN9YoTc4tL89L1kvNzNzFCgunLDsbFx6wOMQpwMCrx8M54Gxgq xJpYVlyZe4hRgoNZSYR36bugUCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8c3e9DxESSE8sSc1O TS1ILYLJMnFwSjUwrlripHBwFdeuExOr8wLvPZjdu9EydPGJ1oosvbX/XSM/XwtjKqmR13qw R3SO/eaW+TqVDzmdj/kX/7zyu47N+G9b55uqyCr7kPOs60/wte6taV1iLXvm+OE3HneupPz1 6q6apfnq5I3aFxv+tvrX7mSymq1Q/fTmfPuta1yfHguU61iUNffmUSWW4oxEQy3mouJEABvc 7fIiAgAA Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 The return value of clk_get_sys() was immediately used in clk_set_parent(). The first one may return ERR_PTR and the latter only checks if supplied argument is non-NULL. Signed-off-by: Krzysztof Kozlowski --- drivers/clk/ti/clk-43xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/ti/clk-43xx.c b/drivers/clk/ti/clk-43xx.c index 3795fce8a830..c6e1fc704052 100644 --- a/drivers/clk/ti/clk-43xx.c +++ b/drivers/clk/ti/clk-43xx.c @@ -134,7 +134,8 @@ int __init am43xx_dt_clk_init(void) */ clk1 = clk_get_sys(NULL, "cpsw_cpts_rft_clk"); clk2 = clk_get_sys(NULL, "dpll_core_m5_ck"); - clk_set_parent(clk1, clk2); + if (!IS_ERR(clk1) && !IS_ERR(clk2)) + clk_set_parent(clk1, clk2); return 0; }