Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbdGRKTB (ORCPT ); Tue, 18 Jul 2017 06:19:01 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34529 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbdGRKRs (ORCPT ); Tue, 18 Jul 2017 06:17:48 -0400 From: Jonas Gorski Cc: Ralf Baechle , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, James Hogan , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/9] MIPS: BCM63XX: allow NULL clock for clk_get_rate Date: Tue, 18 Jul 2017 12:17:27 +0200 Message-Id: <20170718101730.2541-7-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> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 998 Lines: 33 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: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.") Cc: Ralf Baechle Cc: Florian Fainelli Cc: bcm-kernel-feedback-list@broadcom.com Cc: James Hogan Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Reported-by: Mathias Kresin Signed-off-by: Jonas Gorski --- arch/mips/bcm63xx/clk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c index 73626040e4d6..19577f771c1f 100644 --- a/arch/mips/bcm63xx/clk.c +++ b/arch/mips/bcm63xx/clk.c @@ -339,6 +339,9 @@ EXPORT_SYMBOL(clk_disable); unsigned long clk_get_rate(struct clk *clk) { + if (!clk) + return 0; + return clk->rate; } -- 2.11.0