aboutsummaryrefslogtreecommitdiff
path: root/drivers/fpga/microchip-spi.c
diff options
context:
space:
mode:
authorHans de Goede <[email protected]>2024-05-09 16:15:49 +0200
committerGreg Kroah-Hartman <[email protected]>2024-05-10 11:49:23 +0100
commite21de1455a721a0cb4217b18589ede846f5b0686 (patch)
tree6e218046159c556fabb0dd144c79b485dffad221 /drivers/fpga/microchip-spi.c
parenta3d8728ab079951741efa11360df43dbfacba7ab (diff)
serial: Clear UPF_DEAD before calling tty_port_register_device_attr_serdev()
If a serdev_device_driver is already loaded for a serdev_tty_port when it gets registered by tty_port_register_device_attr_serdev() then that driver's probe() method will be called immediately. The serdev_device_driver's probe() method should then be able to call serdev_device_open() successfully, but because UPF_DEAD is still dead serdev_device_open() will fail with -ENXIO in this scenario: serdev_device_open() ctrl->ops->open() /* this callback being ttyport_open() */ tty->ops->open() /* this callback being uart_open() */ tty_port_open() port->ops->activate() /* this callback being uart_port_activate() */ Find bit UPF_DEAD is set in uport->flags and fail with errno -ENXIO. Fix this be clearing UPF_DEAD before tty_port_register_device_attr_serdev() note this only moves up the UPD_DEAD clearing a small bit, before: tty_port_register_device_attr_serdev(); mutex_unlock(&tty_port.mutex); uart_port.flags &= ~UPF_DEAD; mutex_unlock(&port_mutex); after: uart_port.flags &= ~UPF_DEAD; tty_port_register_device_attr_serdev(); mutex_unlock(&tty_port.mutex); mutex_unlock(&port_mutex); Reported-by: Weifeng Liu <[email protected]> Closes: https://lore.kernel.org/platform-driver-x86/[email protected]/ Tested-by: Weifeng Liu <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/fpga/microchip-spi.c')
0 files changed, 0 insertions, 0 deletions