Skip to content

Commit 0419373

Browse files
hvilleneuvedoogregkh
authored andcommitted
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: 4cf9a88 ("serial: max310x: Check the clock readiness") Cc: [email protected] Signed-off-by: Hugo Villeneuve <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3092678 commit 0419373

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/tty/serial/max310x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static u32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,
641641

642642
/* Wait for crystal */
643643
if (xtal) {
644-
unsigned int val;
644+
unsigned int val = 0;
645645
msleep(10);
646646
regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
647647
if (!(val & MAX310X_STS_CLKREADY_BIT)) {

0 commit comments

Comments
 (0)