All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serial: qcom-geni-serial: minor fixes to get_clk_div_rate()
@ 2022-05-31 18:17 Vijaya Krishna Nivarthi
  2022-05-31 18:28 ` Greg KH
  2022-05-31 19:28 ` Doug Anderson
  0 siblings, 2 replies; 20+ messages in thread
From: Vijaya Krishna Nivarthi @ 2022-05-31 18:17 UTC (permalink / raw)
  To: agross, bjorn.andersson, gregkh, jirislaby, linux-arm-msm,
	linux-serial, linux-kernel
  Cc: quic_msavaliy, dianders, mka, swboyd, Vijaya Krishna Nivarthi

Add missing initialisation and correct type casting

Signed-off-by: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
---
 drivers/tty/serial/qcom_geni_serial.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 4733a23..08f3ad4 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -943,11 +943,11 @@ static int qcom_geni_serial_startup(struct uart_port *uport)
 static unsigned long get_clk_div_rate(struct clk *clk, unsigned int baud,
 			unsigned int sampling_rate, unsigned int *clk_div)
 {
-	unsigned long ser_clk;
+	unsigned long ser_clk = 0;
 	unsigned long desired_clk;
 	unsigned long freq, prev;
 	unsigned long div, maxdiv;
-	int64_t mult;
+	unsigned long long mult;
 
 	desired_clk = baud * sampling_rate;
 	if (!desired_clk) {
@@ -959,8 +959,8 @@ static unsigned long get_clk_div_rate(struct clk *clk, unsigned int baud,
 	prev = 0;
 
 	for (div = 1; div <= maxdiv; div++) {
-		mult = div * desired_clk;
-		if (mult > ULONG_MAX)
+		mult = (unsigned long long)div * (unsigned long long)desired_clk;
+		if (mult > (unsigned long long)ULONG_MAX)
 			break;
 
 		freq = clk_round_rate(clk, (unsigned long)mult);
-- 
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by the Linux Foundation.


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-06-23 23:12 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 18:17 [PATCH] tty: serial: qcom-geni-serial: minor fixes to get_clk_div_rate() Vijaya Krishna Nivarthi
2022-05-31 18:28 ` Greg KH
2022-05-31 19:28 ` Doug Anderson
2022-06-01 10:45   ` Vijaya Krishna Nivarthi
2022-06-01 15:33     ` Doug Anderson
2022-06-03 17:43       ` Vijaya Krishna Nivarthi
2022-06-03 18:40         ` Doug Anderson
2022-06-06 18:19           ` Vijaya Krishna Nivarthi
2022-06-06 19:59             ` Doug Anderson
2022-06-07 17:40               ` Vijaya Krishna Nivarthi
2022-06-07 19:25                 ` Doug Anderson
2022-06-08 18:33                   ` Vijaya Krishna Nivarthi
2022-06-08 22:37                     ` Doug Anderson
2022-06-09 17:48                       ` Vijaya Krishna Nivarthi
2022-06-09 18:08                       ` Vijaya Krishna Nivarthi
2022-06-10  9:33                       ` Vijaya Krishna Nivarthi (Temp) (QUIC)
2022-06-10 17:20                         ` Doug Anderson
2022-06-13 18:16                           ` Vijaya Krishna Nivarthi (Temp) (QUIC)
2022-06-21 17:58                       ` Vijaya Krishna Nivarthi (Temp)
2022-06-23 23:11                         ` Doug Anderson

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.