qca_spi: Add check for kthread_stop

We better not rely on that spi_thread points to a running
thread. So add an check for this.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stefan Wahren 2024-01-28 21:10:45 +01:00 committed by David S. Miller
parent e746094b1b
commit c494a01abe

View File

@ -730,8 +730,10 @@ qcaspi_netdev_close(struct net_device *dev)
qcaspi_write_register(qca, SPI_REG_INTR_ENABLE, 0, wr_verify);
free_irq(qca->spi_dev->irq, qca);
kthread_stop(qca->spi_thread);
qca->spi_thread = NULL;
if (qca->spi_thread) {
kthread_stop(qca->spi_thread);
qca->spi_thread = NULL;
}
qcaspi_flush_tx_ring(qca);
return 0;