From patchwork Fri Sep 1 13:03:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Belova X-Patchwork-Id: 13372596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BC08CA0FE1 for ; Fri, 1 Sep 2023 13:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349641AbjIANEl (ORCPT ); Fri, 1 Sep 2023 09:04:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237214AbjIANEk (ORCPT ); Fri, 1 Sep 2023 09:04:40 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B539210F6; Fri, 1 Sep 2023 06:04:26 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id EF7731866782; Fri, 1 Sep 2023 16:04:22 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id dad7jqbU_Blo; Fri, 1 Sep 2023 16:04:22 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 9E92A1865E84; Fri, 1 Sep 2023 16:04:22 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dpsgIrz02uZS; Fri, 1 Sep 2023 16:04:22 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.23]) by mail.astralinux.ru (Postfix) with ESMTPSA id ADACD1866136; Fri, 1 Sep 2023 16:04:21 +0300 (MSK) From: Anastasia Belova To: Michael Turquette Cc: Anastasia Belova , Stephen Boyd , Mike Looijmans , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] clk: cdce925: change condition in cdce925_clk_round_rate Date: Fri, 1 Sep 2023 16:03:59 +0300 Message-Id: <20230901130359.20561-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org To avoid division by zero add check if divider is zero. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 19fbbbbcd3a3 ("Add TI CDCE925 I2C controlled clock synthesizer driver") Signed-off-by: Anastasia Belova --- drivers/clk/clk-cdce925.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c index 96ac90364847..d903cdc3ad7d 100644 --- a/drivers/clk/clk-cdce925.c +++ b/drivers/clk/clk-cdce925.c @@ -441,7 +441,7 @@ static long cdce925_clk_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long l_parent_rate = *parent_rate; u16 divider = cdce925_calc_divider(rate, l_parent_rate); - if (l_parent_rate / divider != rate) { + if (divider && l_parent_rate / divider != rate) { l_parent_rate = cdce925_clk_best_parent_rate(hw, rate); divider = cdce925_calc_divider(rate, l_parent_rate); *parent_rate = l_parent_rate;