Received: by 10.192.165.148 with SMTP id m20csp745222imm; Wed, 25 Apr 2018 07:05:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx49wrxXTbMWVzWP/7Ogy2Sm8aDM0usC3QgJyDT1y/f0zDAwHe7QAyZ09LCrfbHrKWqVWbYZ+ X-Received: by 10.99.116.67 with SMTP id e3mr23561632pgn.369.1524665102055; Wed, 25 Apr 2018 07:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524665102; cv=none; d=google.com; s=arc-20160816; b=tnd8FtWNaTOQnj3nZKaRxCMozrFZUNwJMbdKfn1495bYGsfpM+wk8u6qarDybD3HgF hG/r07D5E8qnkNf77hCd1fIB/Z3QvPlTgJe3txBQDHM7OMO7FO9cgkK0uH6beDyGl9Pc TrAf8g/mBuCVn9fTE4mH4ge547J12CBv64vDKhcpF0nCQD716q6aqV5IuOssNZDYhWsD hlVgQn0ZpEfqFfd3wvNhL31jVSb6lWjPEnVnOQXzyHbzrJUvPovUHlcnuCZ/VwfzgqMv nI0UtG58ZdyvN2RykVApR/0ORhSWo6sdur1zOf9hO5Z7zpLf25ZgTSPVYu2xCaPevvEl WAJg== 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=yK1T+5MqKJIDTSuTxykXl2KpNh/sdQ5B6z+mRbcd95k=; b=YJILRsNMmB9z1YwWMRK0DJlXkWOw8vVenxYFxacRVbWs1mjJdfwYT+O7JxVGQIqFbQ C+jA1FWA2ZYHxFtVAjrZohGOpv8J+Bq6jAZk31kgXtwZq4hJlwqVrC6VSJUO9bOX19k6 HFyCe25Nsho7KmjifqbJY6nBIFh1msNS48wSNGmGk0JVlIROwviQKrF0c+ZYpoo9p5ki JjdPF4FE9yrXp2ZQojiabomgJduh3Aoq7qtAIbHOCUqezHWREvl6TQT356w8skBcBeT0 j/BCUyrYSO9SgGp0/NVoJ/33zUYOLsSsC6F8HucenwFzoVzx19ZoKNGtInuzIwzx5ZrW DucQ== 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 r29si2575801pgn.9.2018.04.25.07.04.47; Wed, 25 Apr 2018 07:05:01 -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 S1754536AbeDYODQ (ORCPT + 99 others); Wed, 25 Apr 2018 10:03:16 -0400 Received: from smtpgwcipde.automotive.elektrobit.com ([213.95.163.141]:53749 "EHLO smtpgwcipde.elektrobit.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753571AbeDYODO (ORCPT ); Wed, 25 Apr 2018 10:03:14 -0400 X-Greylist: delayed 902 seconds by postgrey-1.27 at vger.kernel.org; Wed, 25 Apr 2018 10:03:13 EDT Received: from denue6es002.localdomain (denue6es002.automotive.elektrobit.com [213.95.163.135]) by smtpgwcipde.elektrobit.com with ESMTP id w3PDlVxc027827-w3PDlVxe027827 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 Apr 2018 15:47:31 +0200 Received: from denue6es002.securemail.local (localhost [127.0.0.1]) by denue6es002.localdomain (Postfix) with SMTP id A45AA19286; Wed, 25 Apr 2018 15:47:31 +0200 (CEST) Received: from denue6es008.ebgroup.elektrobit.com (denue6es008.ebgroup.elektrobit.com [10.5.139.25]) by denue6es002.localdomain (Postfix) with ESMTPS; Wed, 25 Apr 2018 15:47:31 +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; Wed, 25 Apr 2018 15:47:30 +0200 Date: Wed, 25 Apr 2018 15:47:30 +0200 From: Stefan Potyra To: Mark Brown CC: Florian Fainelli , Florian Fainelli , , , , , Jonas Gorski , , Subject: [PATCH v3] spi/bcm63xx-hspi: Enable the clock before calling Message-ID: <20180425134728.GA20897@er01809n.ebgroup.elektrobit.com> References: <20180419130358.r7dva6owy2izyfus@agrajag.zerfleddert.de> <20180424161605.GA17825@er01809n.ebgroup.elektrobit.com> <20180424173253.GF22073@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: <20180424173253.GF22073@sirena.org.uk> User-Agent: Mutt/1.9.5 (2018-04-13) X-Originating-IP: [10.0.24.181] X-ClientProxiedBy: denue6es008.ebgroup.elektrobit.com (10.5.139.25) 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 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hssp= i.c index cbcba614b253..8475703543e5 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c @@ -352,22 +352,27 @@ static int bcm63xx_hsspi_probe(struct platform_device= *pdev) if (IS_ERR(clk)) return PTR_ERR(clk); =20 + ret =3D clk_prepare_enable(clk); + if (ret) + return ret; + rate =3D clk_get_rate(clk); if (!rate) { struct clk *pll_clk =3D devm_clk_get(dev, "pll"); =20 - if (IS_ERR(pll_clk)) - return PTR_ERR(pll_clk); + if (IS_ERR(pll_clk)) { + ret =3D PTR_ERR(pll_clk); + goto out_disable_clk; + } + =20 rate =3D clk_get_rate(pll_clk); - if (!rate) - return -EINVAL; + if (!rate) { + ret =3D -EINVAL; + goto out_disable_clk; + } } =20 - ret =3D clk_prepare_enable(clk); - if (ret) - return ret; - master =3D spi_alloc_master(&pdev->dev, sizeof(*bs)); if (!master) { ret =3D -ENOMEM; --=20 2.17.0 --Kj7319i9nmIyA2yE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEATY+KFcrMtHMM+b3X8uyjJIzOwAFAlrghugACgkQX8uyjJIz OwAP0w/6Aw6QHIS37j2GJwPo22PVw14H7EdiBnG5i+Z1erP3PhP/bw3+NfwchKX1 GDF4cwQ0YPHkhBoDGaa/gM/39HxOU4O/cefP2j+yzXvhCHtQlxMOlz+0juwiA5tj SfVmFAvju5FlhRCZijkaxD5V3rDQ0Zh0PDQUADpSUoboVtkQHrUuTbl6RgMj4Joq gcIfeaKAvTp+eWxXKAUNAaZEvBMLGCtSsvKKakw98NTT0CX4fAzRzIQKiO1CUMJR NB3Sq/wJ7ETYxm8kIM2l7f5pqapaRMBV37bBkkw38o5+BLtoC+uo37f+uWr3WAi4 RvNq5I65hTCc+leKiW7Y62klkYkFDd9VZjSvDyKcEXtXUNbtg1LLGdNPvERiCotQ bzBjeQadiG/qxvqF9U7cD1jfspyj0Q4bHf/iO2SKShOJfOijmA/xeqjsyZuZlzBi gCPxjFPae/b+i8SN/jcug0DwD305U2OsWR+IUisp0kQqhffe/+fFy70OGUCmQPoG 13CcpuuIebgdO7FDkRhG7K/aYr37v22mAveNMrEuvxemadVgA9R2/feRFUEZmoGN NdYLNkqlnKum2Og+WbYYkCiw7XnOLayF2P1EyYai6oDgq53WuY7pR4aBXky0kbtk dQTxr378eFxS1RDOQRhphb56tGYmsPx/GefUKRoeFpjQSuV5N5E= =FsCe -----END PGP SIGNATURE----- --Kj7319i9nmIyA2yE--