Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751485AbdGRKRo (ORCPT ); Tue, 18 Jul 2017 06:17:44 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34974 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbdGRKRm (ORCPT ); Tue, 18 Jul 2017 06:17:42 -0400 From: Jonas Gorski Cc: Hartley Sweeten , Alexander Sverdlin , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] ARM: ep93xx: allow NULL clock for clk_get_rate Date: Tue, 18 Jul 2017 12:17:22 +0200 Message-Id: <20170718101730.2541-2-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: 1060 Lines: 32 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: 1d81eedb8f6c ("[ARM] 3634/1: ep93xx: initial implementation of the clk_* API") Cc: Hartley Sweeten Cc: Alexander Sverdlin 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-ep93xx/clock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c index 39ef3b613912..f0768befafe8 100644 --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c @@ -316,6 +316,9 @@ static unsigned long get_uart_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk) { + if (!clk) + return 0; + if (clk->get_rate) return clk->get_rate(clk); -- 2.11.0