Commit 04193733 authored by Hugo Villeneuve's avatar Hugo Villeneuve Committed by Greg Kroah-Hartman

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: 4cf9a888 ("serial: max310x: Check the clock readiness")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20240116213001.3691629-2-hugo@hugovil.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 30926783
...@@ -641,7 +641,7 @@ static u32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s, ...@@ -641,7 +641,7 @@ static u32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,
/* Wait for crystal */ /* Wait for crystal */
if (xtal) { if (xtal) {
unsigned int val; unsigned int val = 0;
msleep(10); msleep(10);
regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val); regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
if (!(val & MAX310X_STS_CLKREADY_BIT)) { if (!(val & MAX310X_STS_CLKREADY_BIT)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment