From patchwork Tue Jul 18 10:17:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 9847541 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 9B0B5602A7 for ; Tue, 18 Jul 2017 10:18:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8572F26E1A for ; Tue, 18 Jul 2017 10:18:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7832F252D5; Tue, 18 Jul 2017 10:18:43 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6ED66252D5 for ; Tue, 18 Jul 2017 10:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sfwyxba0bKofVyH2B86O5jucX9iwSCkFLmxM+MvR1M4=; b=P+5S/EZaf9ZTTqLNMiCCsgBAXO GmXRBcEDw7CkXvXcWMBLV7ePC5N1hWc+kr230VzVgzOg8h8nHpMdnaYj3JTjekMDMi8PWv+2x6IFr B1oGF9yavI+VUry280v+D6by4wXIT04A0Ri6OEtK4DjzFsXfnyBSf1RS0iDN8ae1j+phyvfkiuXIv 7+uM18+16rn+oz4fdUk3aOjAM8J20hvo8pD2DTIRPigBX+wTw1+Yxcdic/yqsdvwS1ZoXv7Pfk2VG dMcvxyMZOHnWsETGBGu729qOx3utztO9uNafBppWVNA1FxMG/D7ODJqCz4w+OrHKXI3/ntM1B+242 pO9oD5+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXPaR-0006TA-Aa; Tue, 18 Jul 2017 10:18:39 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXPZq-0005rV-E2 for linux-arm-kernel@lists.infradead.org; Tue, 18 Jul 2017 10:18:10 +0000 Received: by mail-wr0-x241.google.com with SMTP id y67so1449889wrb.3 for ; Tue, 18 Jul 2017 03:17:43 -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:in-reply-to:references; bh=zUITSSYpqb+VxdD9jSiTZCuf0G8/PaecYS8TjlZdw30=; b=OUpIUaVsYYftDZ3vuskGKPH3EaV8a6Xizlpjm0AJecAiK/qXTVKOobX3h/GZloPyzp L3//c4AOvscY0FPyiJim1Kq04zQptiRynx9t3tn5OB1xoyqbtRqWp5OR2S5aYDUkxhH1 188/aWUFOi6as7AdV1boOZO3IRJS7mPaXptobArnAaDsDKlbeaaBqetQ7PV/Nm8QlEN2 vp95n6S2XxGdaosBx6MjUyoWPEL2zPglDASpNKSwaThlclROHQJ7PIqUn+RaG7MzipUL 2BREONBorITqQo0QWYVlsWoGoX2aAsEo5k3lYVZIoQRXHdLudF7KaaER01Fn7E65ICI8 RXIw== 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:in-reply-to :references; bh=zUITSSYpqb+VxdD9jSiTZCuf0G8/PaecYS8TjlZdw30=; b=edJ6qZWJSf4UMvFqajR+rQvc5vX7qOBgtD63mIcF9KLNnQw591a+54xr0R7BYzbHIf VM1469XBd960ZHWsoem+/4nAUNoPiV4O5dhvR6MLMSLwGoJRS7KYca38/40rsDhEMFZl LgrjgOIwaWYXoehDL320jHLWCsE7BGRbGHKKuddJ3w6UKJzUHdwnbCV5EKy36/nFiLHD MP5M/kcfM3DtxB4GaUQga0JRWUv/1nuys9s48vg7G4Cj95SLvUOUCBcvSKO6tVq8QScF vV0fZy4TBToTfQCyRUSBIH/fTKuWjFwAHi4KVm4t9NUIp9NOmN6QFHYfBhIxejR0vcg8 5Lyg== X-Gm-Message-State: AIVw111uMvJ9NjM7cLo+ZOq9USxfXVYxkY1n+Spnzat8Iff0GUEOC/by QMdrZ5BR2mISBA== X-Received: by 10.223.172.211 with SMTP id o77mr582958wrc.201.1500373062218; Tue, 18 Jul 2017 03:17:42 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::48e]) by smtp.gmail.com with ESMTPSA id 9sm3253728wml.25.2017.07.18.03.17.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jul 2017 03:17:41 -0700 (PDT) From: Jonas Gorski To: Subject: [PATCH 2/9] ARM: mmp: allow NULL clock for clk_get_rate Date: Tue, 18 Jul 2017 12:17:23 +0200 Message-Id: <20170718101730.2541-3-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170718101730.2541-1-jonas.gorski@gmail.com> References: <20170718101730.2541-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170718_031802_653558_A27F07D9 X-CRM114-Status: GOOD ( 11.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Eric Miao , Russell King , Haojian Zhuang , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Make the behaviour of clk_get_rate consistent with common clk's clk_get_rate by accepting NULL clocks as parameter. Some device drivers rely on this, and will cause an OOPS otherwise. Fixes: 49cbe78637eb ("[ARM] pxa: add base support for Marvell's PXA168 processor line") Cc: Eric Miao Cc: Haojian Zhuang Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reported-by: Mathias Kresin Signed-off-by: Jonas Gorski --- arch/arm/mach-mmp/clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c index 28fe64c6e2f5..bdfb113431ec 100644 --- a/arch/arm/mach-mmp/clock.c +++ b/arch/arm/mach-mmp/clock.c @@ -83,7 +83,9 @@ unsigned long clk_get_rate(struct clk *clk) { unsigned long rate; - if (clk->ops->getrate) + if (!clk) + rate = 0; + else if (clk->ops->getrate) rate = clk->ops->getrate(clk); else rate = clk->rate;