From: Hugo Villeneuve <hugo@hugovil.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
jan.kundrat@cesnet.cz, shc_work@mail.ru
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
hugo@hugovil.com, Hugo Villeneuve <hvilleneuve@dimonoff.com>,
stable@vger.kernel.org
Subject: [PATCH 1/4] serial: max310x: set default value when reading clock ready bit
Date: Tue, 16 Jan 2024 16:29:58 -0500 [thread overview]
Message-ID: <20240116213001.3691629-2-hugo@hugovil.com> (raw)
In-Reply-To: <20240116213001.3691629-1-hugo@hugovil.com>
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
If regmap_read() returns a non-zero value, the 'val' variable can be left
uninitialized.
Clear it before calling regmap_read() to make sure we properly detect
the clock ready bit.
Fixes: 4cf9a888fd3c ("serial: max310x: Check the clock readiness")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
drivers/tty/serial/max310x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index f3a99daebdaa..b2c753ba9cbf 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -641,7 +641,7 @@ static u32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,
/* Wait for crystal */
if (xtal) {
- unsigned int val;
+ unsigned int val = 0;
msleep(10);
regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
if (!(val & MAX310X_STS_CLKREADY_BIT)) {
--
2.39.2
next prev parent reply other threads:[~2024-01-16 21:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 21:29 [PATCH 0/4] serial: max310x: probe fixes Hugo Villeneuve
2024-01-16 21:29 ` Hugo Villeneuve [this message]
2024-01-16 21:29 ` [PATCH 2/4] serial: max310x: improve crystal stable clock detection Hugo Villeneuve
2024-01-16 21:30 ` [PATCH 3/4] serial: max310x: fail probe if clock crystal is unstable Hugo Villeneuve
2024-01-16 21:30 ` [PATCH 4/4] serial: max310x: prevent infinite while() loop in port startup Hugo Villeneuve
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=20240116213001.3691629-2-hugo@hugovil.com \
--to=hugo@hugovil.com \
--cc=gregkh@linuxfoundation.org \
--cc=hvilleneuve@dimonoff.com \
--cc=jan.kundrat@cesnet.cz \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=shc_work@mail.ru \
--cc=stable@vger.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.