diff options
author | Hugo Villeneuve <[email protected]> | 2023-12-21 18:18:08 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2024-01-04 16:30:03 +0100 |
commit | 8a1060ce974919f2a79807527ad82ac39336eda2 (patch) | |
tree | 764763303a9c162c987c88a603dbd228b89ff406 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | 0c2a5f471ce58bca8f8ab5fcb911aff91eaaa5eb (diff) |
serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error
If an error occurs during probing, the sc16is7xx_lines bitfield may be left
in a state that doesn't represent the correct state of lines allocation.
For example, in a system with two SC16 devices, if an error occurs only
during probing of channel (port) B of the second device, sc16is7xx_lines
final state will be 00001011b instead of the expected 00000011b.
This is caused in part because of the "i--" in the for/loop located in
the out_ports: error path.
Fix this by checking the return value of uart_add_one_port() and set line
allocation bit only if this was successful. This allows the refactor of
the obfuscated for(i--...) loop in the error path, and properly call
uart_remove_one_port() only when needed, and properly unset line allocation
bits.
Also use same mechanism in remove() when calling uart_remove_one_port().
Fixes: c64349722d14 ("sc16is7xx: support multiple devices")
Cc: <[email protected]>
Cc: Yury Norov <[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]>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions