OSDN Git Service

spi: amd: Fix refcount underflow on remove
authorLukas Wunner <lukas@wunner.de>
Mon, 4 May 2020 11:12:04 +0000 (13:12 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 4 May 2020 16:18:48 +0000 (17:18 +0100)
commit7b9c94bd13cc9dc9c0c4932ebacf756ae612d52a
treeacc416a8a3680e6f59ee7603e1c26c8cdaef9d87
parent4332ea8f40c80d51a534f194291bf3b7738a7beb
spi: amd: Fix refcount underflow on remove

The AMD SPI driver calls spi_master_put() in its ->remove() hook even
though the preceding call to spi_unregister_master() already drops a
ref, thus leading to a refcount underflow.  Drop the superfluous call
to spi_master_put().

This only leaves the call to spi_unregister_master() in the ->remove()
hook, so it's safe to change the ->probe() hook to use the devm version
of spi_register_master() and drop the ->remove() hook altogether.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: https://lore.kernel.org/r/5e53ccdf1eecd4e015dba99d0d77389107f8a2e3.1588590210.git.lukas@wunner.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-amd.c