Received: by 10.192.165.148 with SMTP id m20csp4848774imm; Tue, 24 Apr 2018 09:19:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/h6qXq6NYOdoQ/7GI2P3XqXhrQgbPU5TlAlEvJ+id1RwKjJQ4gcye3elRioacfuWSDMo+U X-Received: by 10.167.131.203 with SMTP id j11mr24885971pfn.101.1524586769538; Tue, 24 Apr 2018 09:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524586769; cv=none; d=google.com; s=arc-20160816; b=xL80wsskbRSIIt+8SXhDzlcKBcfmql7eyKFo7spVwpPH5fo/Bv1UKZbZvc507P/484 EgCJIxuFeuHYoVZaAzo4u8vRRlGKt1jpFDYT6yyEjRhAOt9lc0yyIQ6OxvF6AoNc54Oj bgsxykSQVWzuxeQwbb2UBIZ9kx98IGaTs27b9Yvx089Y0nIzu65WK3NJFP4AAlRKdIQL N2DZTz3nUQG3WwsIlfl/VjFypwNXxM2J1NQ2mIKWi+oA6M2szyF/xxyEJ+1CFzrBaEfd HoqhRIB8yA+gAmR89k6aSw1G388gg5XGjGVpH2qvYHvL88onI0CiEmMOlWQj+PJtqv9C lqkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=/hDuvkS+qbMZ5+v0G/hxOBojpH+G4NGgtE0Iz87M7to=; b=KaioGmPXLAieqDfZ3JMsqbJHcjgqb5WCjaHlRjW6+gYbEd0Ol+lpCQkJ1YheRFnk0w XwKGmbSE+bbKGoDAQBeSd5ZFcYUwWjPCMKWgc4nzxZe0es75oxcyPEX2h4YysPJQY3ye eG2sbzDeKzA5er/WBQsWCM74vZ85L24SN1/lwm5WEDjWxfU9sno8ofXf/OHqUhcapqwb RkKQ3SkOaqyx82Bn0euJBX141bP1fjyBFIqz3w61coykGiS6jgdaUfJJAXey4e20mO0o XViwNQqT6v/XSR/8q6WlDpYyn142t6+jmER4WZBwh6x4Bw8MyxY8ais1Qw2b++2ExM9Q o03g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e66-v6si12920146plb.499.2018.04.24.09.19.15; Tue, 24 Apr 2018 09:19:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752225AbeDXQQq (ORCPT + 99 others); Tue, 24 Apr 2018 12:16:46 -0400 Received: from smtpgwcipde.automotive.elektrobit.com ([213.95.163.141]:56266 "EHLO smtpgwcipde.elektrobit.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbeDXQQn (ORCPT ); Tue, 24 Apr 2018 12:16:43 -0400 X-Greylist: delayed 757 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Apr 2018 12:16:42 EDT Received: from denue6es002.localdomain (denue6es002.automotive.elektrobit.com [213.95.163.135]) by smtpgwcipde.elektrobit.com with ESMTP id w3OGG6ev019032-w3OGG6ex019032 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 24 Apr 2018 18:16:06 +0200 Received: from denue6es002.securemail.local (localhost [127.0.0.1]) by denue6es002.localdomain (Postfix) with SMTP id 5584119283; Tue, 24 Apr 2018 18:16:06 +0200 (CEST) Received: from denue6es008.ebgroup.elektrobit.com (denue6es008.ebgroup.elektrobit.com [10.5.139.25]) by denue6es002.localdomain (Postfix) with ESMTPS; Tue, 24 Apr 2018 18:16:05 +0200 (CEST) Received: from localhost (10.0.24.181) by denue6es008.ebgroup.elektrobit.com (10.5.139.25) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 24 Apr 2018 18:16:05 +0200 Date: Tue, 24 Apr 2018 18:16:05 +0200 From: Stefan Potyra To: Florian Fainelli CC: Mark Brown , Florian Fainelli , , , , , Jonas Gorski , , Subject: [PATCH v2] spi/bcm63xx-hspi: Enable the clock before calling clk_get_rate(). Message-ID: <20180424161605.GA17825@er01809n.ebgroup.elektrobit.com> References: <20180419130358.r7dva6owy2izyfus@agrajag.zerfleddert.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) X-Originating-IP: [10.0.24.181] X-ClientProxiedBy: denue6es007.ebgroup.elektrobit.com (10.5.139.21) To denue6es008.ebgroup.elektrobit.com (10.5.139.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable the clock prior to calling clk_get_rate(), because clk_get_rate() should only be called if the clock is enabled. Found by Linux Driver Verification project (linuxtesting.org). Fixes: 142168eba9dc (spi: "bcm63xx-hsspi: add bcm63xx HSSPI driver") Signed-off-by: Stefan Potyra --- drivers/spi/spi-bcm63xx-hsspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c index cbcba614b253..46cd9b683d22 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c @@ -352,6 +352,10 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) if (IS_ERR(clk)) return PTR_ERR(clk); + ret = clk_prepare_enable(clk); + if (ret) + return ret; + rate = clk_get_rate(clk); if (!rate) { struct clk *pll_clk = devm_clk_get(dev, "pll"); @@ -364,10 +368,6 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) return -EINVAL; } - ret = clk_prepare_enable(clk); - if (ret) - return ret; - master = spi_alloc_master(&pdev->dev, sizeof(*bs)); if (!master) { ret = -ENOMEM; -- 2.17.0