Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2955748imu; Mon, 19 Nov 2018 08:35:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/VqEF9e42xpFraEN5k59coJXwNGrkspJyHBQF0e3c43atY6iPJJBVUtAfHw0l7Kl4YYZDtB X-Received: by 2002:a17:902:87:: with SMTP id a7mr188063pla.239.1542645320508; Mon, 19 Nov 2018 08:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645320; cv=none; d=google.com; s=arc-20160816; b=Ozk6P3X2zXrmpVA8YM61rI+b+W8dgHT5llV9l5zl4W922ITLTk2CBJl1Gc1oO3r0aY 0mf2iTnbJH4SSrtq3Lvpf7JmCJZHhpUcqaVZuxl9u/f+Zm1nu6T6pLs22p5p2F9LbgpQ Od4xQaSXOx1lYUG/LtsOs1xN0A/abyW8jzMolMOTQ/M9DgBINwY4K1o5PdFouL1aW4/X /gasxBSjl9WlN+uftmr61S5LFqTimBmnJXoq5dcTQUP8NJY2kYB8azdWPySVuIwN+VIu AL2qNNNWy7NXmuk+PEWjSon54dkCshG4Q6RJenU1yQ2LZ463amUpBGEsR042hfXequgt xrfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YFNc2LBVBUluM+DD/9QPt+koQbtWi+oLxlatD8OBwVc=; b=CBKdJQDAfGIm88FbPHzl4p6E0monWhihVvnl9uXWhoSTpWqftUW+IaILRAtTgoJD9J 4clBdc3icNJtA+wQq2ItuoM1SlXNUcM9cYHTQRagKHHG8rqXvBjhssoS5inPOk9YCOdl +0lT6UApjC3CEuGZ5JmrsqPH5N3IhbexfXnkDWYSbrGpsy7N9dz7CNm7Dxqrxm+QmJqB gwTw7xcuekyDHw+6I6T6r+z6CKC4ZtMlqtHH2xJ+ps0/ZPEuJjRcx7UJamep29qle8T6 arCPSmBj/+Ni22uGUbfrdF3TjaXTyJyS+JN/VW399cjID7HUOcHOEuMRMe4NFcCR9/GQ HVZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JZRhcD8Q; 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 l185si38542851pgd.253.2018.11.19.08.35.00; Mon, 19 Nov 2018 08:35:20 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=JZRhcD8Q; 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 S1731151AbeKTC5o (ORCPT + 99 others); Mon, 19 Nov 2018 21:57:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:56518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731102AbeKTC5o (ORCPT ); Mon, 19 Nov 2018 21:57:44 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CDC5C2086A; Mon, 19 Nov 2018 16:33:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645216; bh=4LX1nvowkUY9qgHbcJ8g9bUQmbIaDP0IbtM8k81Cirw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZRhcD8Qkxn45DgBn6btSlby4/CnA5UxTGRpsCAlDVsUStUVzpeS0UUx29d3DqC/M F0ArGmaK+4vX68L5LUiKVzRVkJmPrLl/DZnGijy/ctLZeIiF/BrFbw11vi4yGud3i6 Ac6bv9r5eYgFBFsyazRofDfTcWQ34bK2iaOFcLfc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronald Wahl , Ludovic Desroches , Stephen Boyd Subject: [PATCH 4.19 081/205] clk: at91: Fix division by zero in PLL recalc_rate() Date: Mon, 19 Nov 2018 17:26:28 +0100 Message-Id: <20181119162630.918818995@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ronald Wahl commit 0f5cb0e6225cae2f029944cb8c74617aab6ddd49 upstream. 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 Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/clk/at91/clk-pll.c | 3 +++ 1 file changed, 3 insertions(+) --- 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_pll *pll = to_clk_pll(hw); + if (!pll->div || !pll->mul) + return 0; + return (parent_rate / pll->div) * (pll->mul + 1); }