]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: ch341: fix devres lifetime
authorJohan Hovold <johan@kernel.org>
Fri, 27 Mar 2026 10:43:05 +0000 (11:43 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 1 Apr 2026 17:21:09 +0000 (18:21 +0100)
commitabe572f630bc1f0e77041012ab075869036ede4f
tree23263f62438afc5cc7605692d7faa5ce4ebc6386
parentb99e3ddb91b499d920e63a2daff8880be68cfe9e
spi: ch341: fix devres lifetime

USB drivers bind to USB interfaces and any device managed resources
should have their lifetime tied to the interface rather than parent USB
device. This avoids issues like memory leaks when drivers are unbound
without their devices being physically disconnected (e.g. on probe
deferral or configuration changes).

Fix the controller and driver data lifetime so that they are released
on driver unbind.

Note that this also makes sure that the SPI controller is placed
correctly under the USB interface in the device tree.

Fixes: 8846739f52af ("spi: add ch341a usb2spi driver")
Cc: stable@vger.kernel.org # 6.11
Cc: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260327104305.1309915-3-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-ch341.c