]> git.baikalelectronics.ru Git - kernel.git/commit
spi-mux: Fix false-positive lockdep splats
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 13 Oct 2021 13:37:10 +0000 (15:37 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 14 Oct 2021 12:32:19 +0000 (13:32 +0100)
commit47fea57fd4bc3d3ffa62b966ba221c436dcb16a5
treeec9c22b3f88095ffa7e4885b9dfa7ba5ced1ab06
parent7cdcb54b4579e40cae8be611c895e409b0464682
spi-mux: Fix false-positive lockdep splats

io_mutex is taken by spi_setup() and spi-mux's .setup() callback calls
spi_setup() which results in a nested lock of io_mutex.

add_lock is taken by spi_add_device(). The device_add() call in there
can result in calling spi-mux's .probe() callback which registers its
own spi controller which in turn results in spi_add_device() being
called again.

To fix this initialize the controller's locks already in
spi_alloc_controller() to give spi_mux_probe() a chance to set the
lockdep subclass.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211013133710.2679703-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-mux.c
drivers/spi/spi.c