summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHugo Villeneuve <hvilleneuve@dimonoff.com>2024-01-16 22:29:58 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-28 04:09:09 +0100
commit0419373333c2f2024966d36261fd82a453281e80 (patch)
tree54cfcc40770a560a4146d7fc970873dce087386b /drivers
parentserial: core: Fix atomicity violation in uart_tiocmget (diff)
downloadlinux-0419373333c2f2024966d36261fd82a453281e80.tar.xz
linux-0419373333c2f2024966d36261fd82a453281e80.zip
serial: max310x: set default value when reading clock ready bit
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> Link: https://lore.kernel.org/r/20240116213001.3691629-2-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/max310x.c2
1 files changed, 1 insertions, 1 deletions
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)) {