From patchwork Wed Oct 10 10:31:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronald Wahl X-Patchwork-Id: 10634323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC0D214BD for ; Wed, 10 Oct 2018 10:31:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D82929C87 for ; Wed, 10 Oct 2018 10:31:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5164029D0F; Wed, 10 Oct 2018 10:31:59 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 B5EF229C87 for ; Wed, 10 Oct 2018 10:31:58 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:Message-ID:Date :Subject:To:From:Reply-To:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DCpyAMTpGAdlr9uCFt196UAxkJ0u1HjorM33vm416Mw=; b=CAG2IHAjsF7FSx PuHbHxaOnCI6+9Uq3kUc/J8LMkAzx+VmIUWfXQvRmDclODxH7+bE2SuVD5cwq1b5gvebLnk4Z4hRc SxuFrW2hyCnvT/6pl9FJP+ZWoa3M9b2i3urdeJcPxxom2T5T1cKfol3oZ87ppm6ATTV/vTyzgKOLl 8CAjcsnVb/t6oYogry+9GWeXHkD65BuvJPuuPpT30BOR4qQfg0Mydsb6hU+QODMHVkxeQVtKYAdq/ CQc05Yw7L4WU84U37xNp6hA0zOj4+rVvfSEupUjLt4ApKknDKMgBvSXZ9w5uO32WPUep4SN+J9Z0s tfa/qtaxaotlQoh67gKg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gABmV-0002NC-A3; Wed, 10 Oct 2018 10:31:55 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gABmQ-0002MC-Tp for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 10:31:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=MIME-Version:Content-Transfer-Encoding: Content-ID:Content-Type:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/z25s37Mb2dJY3GYQOluXPTJyn3PdrMPxrx4SzuhWGU=; b=CeWSNR4Wy53zhUrc8qWJucfOPv qoKG1uOo+ccCvyoBlHf9Xku6x89C3jEcT4hlK+wES8Jh7jITjs8un3XHmxkkT6FKBDFzA/ZNH9HOb xZN3NFuHpyOHNPlOoRDsCzzP7CwVLGK1q5Gi3MhxSrY4DELRNmcjrdqzjJN6067m2BA99y8t/qLf0 O0zb+gO52XwUmZPfe8AM7sOevtOpnYaiRAr+TmjHat8DcsmxB37L7j6KfU/ME2mBqF7MKUUl9IEZa WzcNe9KlELcrKW+pJU26OddauNgggqxlkrMwe4L2eBHEsTCEbfUnVb+6iul8WDdrGoMOgTSCQ6eof 3OGjZbFQ==; Received: from mail-eopbgr20108.outbound.protection.outlook.com ([40.107.2.108] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gABmN-0004Ur-7W for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 10:31:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grpleg.onmicrosoft.com; s=selector1-grpleg-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/z25s37Mb2dJY3GYQOluXPTJyn3PdrMPxrx4SzuhWGU=; b=YX3rZyxKBAHfcrsJth6lAeqjFJLFsLgpsbtErW/FlJqrZ8UT93TkuL7xkr3AB9108DlpgugKwaXknkUn6dnbQNR5R/yxrKEk1SDqOhkgdLy0ACYZlWxNFBBnJhs/Az/oJ9myFwjuKi1hviW/dqGPft76lMTuMk9COV1rNpLo/1c= Received: from VI1PR0601MB2125.eurprd06.prod.outlook.com (10.169.136.10) by VI1PR0601MB2255.eurprd06.prod.outlook.com (10.173.82.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21; Wed, 10 Oct 2018 10:31:31 +0000 Received: from VI1PR0601MB2125.eurprd06.prod.outlook.com ([fe80::69a2:bd0c:48b:f834]) by VI1PR0601MB2125.eurprd06.prod.outlook.com ([fe80::69a2:bd0c:48b:f834%10]) with mapi id 15.20.1228.020; Wed, 10 Oct 2018 10:31:31 +0000 From: Ronald WAHL To: Stephen Boyd , Boris Brezillon , Nicolas Ferre Subject: [PATCH] clk: at91: Fix division by zero in PLL recalc_rate() Thread-Topic: [PATCH] clk: at91: Fix division by zero in PLL recalc_rate() Thread-Index: AQHUYIRpxMO+Siaq70iP0fn52KRYHQ== Date: Wed, 10 Oct 2018 10:31:31 +0000 Message-ID: Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR08CA0126.eurprd08.prod.outlook.com (2603:10a6:800:d4::28) To VI1PR0601MB2125.eurprd06.prod.outlook.com (2603:10a6:800:2e::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ronald.wahl@raritan.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:1438:4010:702:1a31:bfff:fecb:b295] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0601MB2255; 6:2f83jhjFqmmI0svuBBUMjgb5EuM/XPe70yQ8KrBSrxHW+deudHWVZTm0y0UCHgYjfkc1NrftMFvPjj98rvHmiSmTBoGfoGrSFVSFuxjmWcLItid224sU3mNf29WlaCCX4XDSWBmjhcFvKyfs8Y0NqIHihpaw3i2Z1dWz2xpTBs+K9wuwyacFUMyMif1aF2yUEZF7HPYh1fe8qlbKOExcKDKODklW24WRIcckalcvs6mJwu+GG9uEKMJ12unqdPpPoBXAIR9GVWnbIxK01r6nBqGuKOsGVJEulKIQRcQPWzIueukPTzszpha9dsEJWoWbwmjxhlbquP09Zv0mFD/RvEyUByD+iE9SClqtb5lHOJI+d2Ojqx8Ct/nUrhFAfCQlT/tw5DPTkU8CnfCJefqSeDkivdNVVADnHMYAU6GMexFqRyE4re2RWweOJyVFRiCX6aSpVVZtkogV8Pq//0l5Uw==; 5:9JgotR8uajEXHugMXzB/gVQKjmufU/yYCIHKtCx59qt0KGiYSMRfo1eIoZVciIhyvfaBz/LRrD72gwFfWLLbZMBItKwaQ1u5Lj3m4gWC+VIFzJkHLlG+LjFa2yCdSSSYnM7bXgff4vz1QIqkpOfHPCtxTxkfcwfwYId4HcHs02c=; 7:eBuBAWXUzEBEcAPqELasGoRe3uQxTFv1vVM4/8HtGG8AiFgrxii6GaYF5LAOHdO0pfRrWFHaXZQxrJgGoTKF3x0euBKZi5OirAsfHh9h9VqH7gz2/gXUSNJ9LvtPtXausg717JZPhVwDjpBytmIWrLSKEl3zP/MRRqYarcJmFNPq+RIsNcypfpiY1P4UBq9H8DbxC1w+G0bxt2yuULxniveAHTDMutCsFhZ7RMEkJKfyl5Qg1Vh+XeYjO4Qd0M9/ x-ms-office365-filtering-correlation-id: 7c8b70e7-671f-4cdb-5f17-08d62e9b8b96 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:VI1PR0601MB2255; x-ms-traffictypediagnostic: VI1PR0601MB2255: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991055); SRVR:VI1PR0601MB2255; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0601MB2255; x-forefront-prvs: 08213D42D3 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(366004)(346002)(376002)(136003)(396003)(39860400002)(199004)(189003)(2906002)(6486002)(105586002)(31686004)(1857600001)(6436002)(68736007)(71190400001)(25786009)(106356001)(4326008)(71200400001)(36756003)(52116002)(386003)(6506007)(102836004)(99286004)(316002)(14454004)(186003)(81156014)(5024004)(81166006)(256004)(14444005)(2616005)(97736004)(6116002)(476003)(53936002)(8676002)(31696002)(305945005)(46003)(66574009)(8936002)(6512007)(486006)(5250100002)(478600001)(110136005)(2900100001)(5660300001)(7736002)(86362001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0601MB2255; H:VI1PR0601MB2125.eurprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: raritan.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: chIwfgX2oeOIfcPvfiERpTUqAKmBYOEUQrr/Dwi0oU6GWZT6xfDRLijImK+xn8vCr0zehUPdwx37Nryrrrx9Lf5m5MeMvZiO1pTDCpqr/E8tm7ghDo5nk8QN/Vsr0lF26ByHHyhAAPmfBlgZduV4PdXH0MBcBpq+qegf0ayHEBRIrHL5tEvuUIss53b/PrXvRkL0rlPZBuPgQjxP6+d5SisE1gleS8E3sbDZ5fhmyQzsMXczeXAnsT3oKej942P90Ws6nAYGZ7zP8R9UlVdBKcGSKafiV19SFbV0nsjF4OW2e0S4sEbW1n/xuhQxK2YRuszixsznyH03L9evOp0IAjZbZ42it+XXagUxK43Zj74= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: raritan.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c8b70e7-671f-4cdb-5f17-08d62e9b8b96 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2018 10:31:31.8962 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 199686b5-bef4-4960-8786-7a6b1888fee3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0601MB2255 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_063147_490887_74B8DEB1 X-CRM114-Status: GOOD ( 18.90 ) 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" 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 Commit a982e45dc150 ("clk: at91: PLL recalc_rate() now using cached MUL and DIV values") removed a check that prevents a division by zero. This now causes a stacktrace when booting the kernel on a at91 platform if the PLL DIV register contains zero. This commit reintroduces this check. Fixes: a982e45dc150 ("clk: at91: PLL recalc_rate() now using cached...") Cc: Signed-off-by: Ronald Wahl Acked-by: Ludovic Desroches --- drivers/clk/at91/clk-pll.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index 72b6091eb7b9..dc7fbc796cb6 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c @@ -133,6 +133,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, { struct clk_pll *pll = to_clk_pll(hw); +if (!pll->div || !pll->mul) +return 0; + return (parent_rate / pll->div) * (pll->mul + 1); }