From patchwork Tue Oct 31 12:17:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Belova X-Patchwork-Id: 160100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp193325vqg; Tue, 31 Oct 2023 05:18:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHozxtjrhiaQZcIktWi8I9iwRCgmblSCbbKilDMe4XYMjv/sPzy4c1VQO2UXtqi/yzKfsp X-Received: by 2002:a05:6a20:7485:b0:171:c88a:891e with SMTP id p5-20020a056a20748500b00171c88a891emr10704967pzd.55.1698754723840; Tue, 31 Oct 2023 05:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698754723; cv=none; d=google.com; s=arc-20160816; b=GMSi5YbMu5mNbsDUYV3R94tR5Mg8Gir4PB2kCIy80Hc87QShhP5fuBddbzxYbC2lEy ETzXfqXlzLzOugkkE5MjZR/ZgwDgp8JbMTIcAmskec+YwB4lGkibyBXFsRFhnyhp/oUa GUpkH+w/XUnYxV8DlPpO/5s1KGZkhv+OszqH35LUSI7pvLFJhO+enBuIiFm/2NHqnLng LoU0Xx/1zfFEhAHp/XAwxnrRMd91k1XixTRQF1Ae84oO1BhG4o37+cAUoXWVmGWj0zQC M9mkv80jcTir7Bk/uCRbn8jitG3lkNEcGkbszG+uL5rya8DQq0wJDT0t3uitUukEr1De ZhkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=cWwvGoZ6uZ503vHBYv+Djkd14gBL8O54PueWLR0p3jo=; fh=3HLmDeHuFTJs3siJzF/UZkz6dCpO+o8Pdj98FfH7Gak=; b=ELN1PJaMY9k7h3vAoU6b6+nEaBbJuAJ0OKkQjkcEz+cy21PffjwLqi66LkS4D2kiQd 3GM15KpcetoWng/Nkm9Usf9zAtG5OzWrxuRXEl7eUlyFS1f2joTYC6hjXsavZepPMR8E UnDF+A5hUq+y9VpehT22FEf48HH6NQhr6tke7lS5e62MdBW3pm30G9RRz9TAUwU6UF0p xaaAaFsk+cHInI+RxxzjqaOv+3rk8qcyVIAqY6JtGApgTwIV/Nxt+vQ9vZ+KTERy8oi/ IQRNucNK8Vi6UmDCafySsAN3YKjLYBg3AUWo+MZupjST+qm3H0gmZivCAOgLKqvFotBx HZyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id k17-20020a056a00135100b0068ff741579fsi932255pfu.318.2023.10.31.05.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 05:18:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 190C78021289; Tue, 31 Oct 2023 05:18:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344214AbjJaMSg (ORCPT + 33 others); Tue, 31 Oct 2023 08:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344200AbjJaMSd (ORCPT ); Tue, 31 Oct 2023 08:18:33 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF3CB97; Tue, 31 Oct 2023 05:18:29 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 297E518686EE; Tue, 31 Oct 2023 15:18:26 +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 aeKeNnMTMAnD; Tue, 31 Oct 2023 15:18:25 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id CA9DE18685C1; Tue, 31 Oct 2023 15:18:25 +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 vjxLYOL5xotF; Tue, 31 Oct 2023 15:18:25 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.58]) by mail.astralinux.ru (Postfix) with ESMTPSA id 11A411864907; Tue, 31 Oct 2023 15:18:24 +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: Tue, 31 Oct 2023 15:17:22 +0300 Message-Id: <20231031121723.5156-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 31 Oct 2023 05:18:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781273433256140036 X-GMAIL-MSGID: 1781273433256140036 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;