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>

authored by Hugo Villeneuve and committed by Greg Kroah-Hartman 04193733 30926783

+1 -1
+1 -1
drivers/tty/serial/max310x.c
··· 641 642 /* Wait for crystal */ 643 if (xtal) { 644 - unsigned int val; 645 msleep(10); 646 regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val); 647 if (!(val & MAX310X_STS_CLKREADY_BIT)) {
··· 641 642 /* Wait for crystal */ 643 if (xtal) { 644 + unsigned int val = 0; 645 msleep(10); 646 regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val); 647 if (!(val & MAX310X_STS_CLKREADY_BIT)) {