From patchwork Wed May 13 06:54:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 6394411 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E14C19F32E for ; Wed, 13 May 2015 06:57:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23F062042C for ; Wed, 13 May 2015 06:57:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 387E420426 for ; Wed, 13 May 2015 06:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753585AbbEMGzF (ORCPT ); Wed, 13 May 2015 02:55:05 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:38283 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753379AbbEMGzA (ORCPT ); Wed, 13 May 2015 02:55:00 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NOA005HW0JLCV50@mailout3.w1.samsung.com>; Wed, 13 May 2015 07:54:57 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-08-5552f540e8fd Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 37.E8.04846.045F2555; Wed, 13 May 2015 07:54:56 +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:54:56 +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 , stable@vger.kernel.org Subject: [RFT PATCH 1/8] clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference Date: Wed, 13 May 2015 15:54:40 +0900 Message-id: <1431500087-2275-2-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+NgFprOLMWRmVeSWpSXmKPExsVy+t/xa7oOX4NCDdqXWVu8fmFo8bHnHqvF 5V1z2CxmL+lnsXg64SKbxY8z3SwWCzY+YrRY8rSDzYHD43JfL5PHnWt72Dz6tqxi9Dh+YzuT x+dNcgGsUVw2Kak5mWWpRfp2CVwZD1+tYCw4xFGxvGU6awNjG3sXIyeHhICJxIH5d6BsMYkL 99azdTFycQgJLGWU+DpzOSuE859RYuHC78wgVWwCxhKbly8BqxIROM4osWJPP1g7s4CnxLu/ D8FsYYEQiU0ty5hAbBYBVYnWe1/BmnkF3CTaHz5kgVgnJ3Hy2GSgDRwcnALuEpfmiYGYQkAl +xrqJjDyLmBkWMUomlqaXFCclJ5rqFecmFtcmpeul5yfu4kRElxfdjAuPmZ1iFGAg1GJh3fG 28BQIdbEsuLK3EOMEhzMSiK8S98FhQrxpiRWVqUW5ccXleakFh9ilOZgURLnnbvrfYiQQHpi SWp2ampBahFMlomDU6qBseZNx7bdXS3XVLwWqTr8yNtZLd4seKLjwhKffZefZu9RCLu+dsFx 5djLuneTJwke+D9j+2WPi5W71Fc/T/R2Fxdg4+9hVTjzyt2lISx3/fQvxikB/j6T2jTeXrWu eM/lFlgZt36Kj7TRGeUKI+kFAUsfPOc0maJcKn7/+fNutqYT3veXhibnKbEUZyQaajEXFScC AAJrt2kqAgAA 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 of_clk_get_from_provider() returns ERR_PTR on failure. The dra7-atl-clock driver was not checking its return value and immediately used it in __clk_get_hw(). __clk_get_hw() dereferences supplied clock, if it is not NULL, so in that case it would dereference an ERR_PTR. Signed-off-by: Krzysztof Kozlowski Cc: Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)") --- drivers/clk/ti/clk-dra7-atl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index d86bc46b93bd..0a1df821860f 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -252,6 +252,11 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) } clk = of_clk_get_from_provider(&clkspec); + if (IS_ERR(clk)) { + pr_err("%s: failed to get atl clock %d from provider\n", + __func__, i); + return PTR_ERR(clk); + } cdesc = to_atl_desc(__clk_get_hw(clk)); cdesc->cinfo = cinfo;