WSL2-Linux-Kernel/drivers/platform
Maximilian Luz b444f5de60 platform/surface: aggregator: Fix warning when controller is destroyed in probe
[ Upstream commit bc923d594db21bee0ead128eb4bb78f7e77467a4 ]

There is a small window in ssam_serial_hub_probe() where the controller
is initialized but has not been started yet. Specifically, between
ssam_controller_init() and ssam_controller_start(). Any failure in this
window, for example caused by a failure of serdev_device_open(),
currently results in an incorrect warning being emitted.

In particular, any failure in this window results in the controller
being destroyed via ssam_controller_destroy(). This function checks the
state of the controller and, in an attempt to validate that the
controller has been cleanly shut down before we try and deallocate any
resources, emits a warning if that state is not SSAM_CONTROLLER_STOPPED.

However, since we have only just initialized the controller and have not
yet started it, its state is SSAM_CONTROLLER_INITIALIZED. Note that this
is the only point at which the controller has this state, as it will
change after we start the controller with ssam_controller_start() and
never revert back. Further, at this point no communication has taken
place and the sender and receiver threads have not been started yet (and
we may not even have an open serdev device either).

Therefore, it is perfectly safe to call ssam_controller_destroy() with a
state of SSAM_CONTROLLER_INITIALIZED. This, however, means that the
warning currently being emitted is incorrect. Fix it by extending the
check.

Fixes: c167b9c7e3 ("platform/surface: Add Surface Aggregator subsystem")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20240811124645.246016-1-luzmaximilian@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-04 13:23:31 +02:00
..
chrome platform/chrome: cros_ec_proto: Lock device when updating MKBP version 2024-08-19 05:45:33 +02:00
goldfish
mellanox platform/mellanox: Check devm_hwmon_device_register_with_groups() return value 2023-12-13 18:36:35 +01:00
mips platform: mips: cpu_hwmon: Disable driver on unsupported hardware 2024-08-19 05:45:20 +02:00
olpc platform/olpc: Fix uninitialized data in debugfs write 2022-08-17 14:23:58 +02:00
surface platform/surface: aggregator: Fix warning when controller is destroyed in probe 2024-09-04 13:23:31 +02:00
x86 platform/x86: lg-laptop: fix %s null argument warning 2024-09-04 13:23:28 +02:00
Kconfig
Makefile