The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Stefan Wahren <wahrenst@gmx.net>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stefan Wahren <wahrenst@gmx.net>
Subject: [PATCH V4 01/15 net-next] qca_spi: Add check for kthread_stop
Date: Sun, 28 Jan 2024 21:10:45 +0100	[thread overview]
Message-ID: <20240128201059.6259-2-wahrenst@gmx.net> (raw)
In-Reply-To: <20240128201059.6259-1-wahrenst@gmx.net>

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>
---
 drivers/net/ethernet/qualcomm/qca_spi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 5f3c11fb3fa2..77bab8bf5203 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -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;
--
2.34.1


  reply	other threads:[~2024-01-28 20:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-28 20:10 [PATCH V4 00/15 net-next] qca_spi: collection of improvements Stefan Wahren
2024-01-28 20:10 ` Stefan Wahren [this message]
2024-01-28 20:10 ` [PATCH V4 02/15 net-next] qca_spi: Improve SPI thread creation Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 03/15 net-next] qca_spi: Improve SPI IRQ handling Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 04/15 net-next] qca_spi: Avoid skb_copy_expand in TX path Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 05/15 net-next] qca_7k_common: Drop unnecessary function description Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 06/15 net-next] qca_7k_common: Drop unused len from qcafrm_handle Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 07/15 net-next] qca_spi: Add QCASPI prefix to ring defines Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 08/15 net-next] qca_spi: Introduce QCASPI_RX_MAX_FRAMES Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 09/15 net-next] qca_spi: Improve calculation of RX buffer size Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 10/15 net-next] qca_spi: Log expected signature in error case Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 11/15 net-next] qca_spi: Adjust log of SPI_REG_RDBUF_BYTE_AVA Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 12/15 net-next] qca_7k: Replace BSD boilerplate with SPDX Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 13/15 net-next] qca_7k: Replace old mail address Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 14/15 net-next] mailmap: add entry for Stefan Wahren Stefan Wahren
2024-01-28 20:10 ` [PATCH V4 15/15 net-next] MAINTAINERS: add entry for qca7k driver(s) Stefan Wahren
2024-01-31 13:40 ` [PATCH V4 00/15 net-next] qca_spi: collection of improvements patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240128201059.6259-2-wahrenst@gmx.net \
    --to=wahrenst@gmx.net \
    --cc=LinoSanfilippo@gmx.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox