Skip to content

Commit e8486bd

Browse files
andy-shevgregkh
authored andcommitted
serial: port: Always update ->iotype in __uart_read_properties()
The documentation of the __uart_read_properties() states that ->iotype member is always altered after the function call, but the code doesn't do that in the case when use_defaults == false and the value of reg-io-width is unsupported. Make sure the code follows the documentation. Note, the current users of the uart_read_and_validate_port_properties() will fail and the change doesn't affect their behaviour, neither users of uart_read_port_properties() will be affected since the alteration happens there even in the current code flow. Fixes: e894b60 ("serial: port: Introduce a common helper to read properties") Cc: stable <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 166ac2b commit e8486bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/tty/serial/serial_port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ static int __uart_read_properties(struct uart_port *port, bool use_defaults)
228228
port->iotype = device_is_big_endian(dev) ? UPIO_MEM32BE : UPIO_MEM32;
229229
break;
230230
default:
231+
port->iotype = UPIO_UNKNOWN;
231232
if (!use_defaults) {
232233
dev_err(dev, "Unsupported reg-io-width (%u)\n", value);
233234
return -EINVAL;
234235
}
235-
port->iotype = UPIO_UNKNOWN;
236236
break;
237237
}
238238
}

0 commit comments

Comments
 (0)