All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	linux-clk@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Biju Das <biju.das.au@gmail.com>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH 1/5] clk: versaclock3: Update vc3_get_div() to avoid divide by zero
Date: Wed, 22 Nov 2023 14:23:06 +0000	[thread overview]
Message-ID: <20231122142310.203169-2-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20231122142310.203169-1-biju.das.jz@bp.renesas.com>

Update vc3_get_div() to avoid divide by zero operation on
vc3_div_round_rate() by returning1, if there is no table match
found.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/clk/clk-versaclock3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-versaclock3.c b/drivers/clk/clk-versaclock3.c
index 00930d7bca77..3aad69a08512 100644
--- a/drivers/clk/clk-versaclock3.c
+++ b/drivers/clk/clk-versaclock3.c
@@ -477,7 +477,7 @@ static unsigned int vc3_get_div(const struct clk_div_table *table,
 		if (clkt->val == val)
 			return clkt->div;
 
-	return 0;
+	return 1;
 }
 
 static unsigned long vc3_div_recalc_rate(struct clk_hw *hw,
-- 
2.25.1


  reply	other threads:[~2023-11-22 14:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 14:23 [PATCH 0/5] Versa3 clock driver enhancements Biju Das
2023-11-22 14:23 ` Biju Das [this message]
2023-12-17 23:58   ` [PATCH 1/5] clk: versaclock3: Update vc3_get_div() to avoid divide by zero Stephen Boyd
2023-11-22 14:23 ` [PATCH 2/5] clk: versaclock3: Avoid unnecessary padding Biju Das
2023-12-17 23:58   ` Stephen Boyd
2023-11-22 14:23 ` [PATCH 3/5] clk: versaclock3: Use u8 return type for get_parent() callback Biju Das
2023-12-17 23:57   ` Stephen Boyd
2023-11-22 14:23 ` [PATCH 4/5] clk: versaclock3: Add missing space between ')' and '{' Biju Das
2023-12-17 23:57   ` Stephen Boyd
2023-11-22 14:23 ` [PATCH 5/5] clk: versaclock3: Drop ret variable Biju Das
2023-12-17 23:57   ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231122142310.203169-2-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=biju.das.au@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.