From: Johan Hovold <johan@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
Johan Hovold <johan@kernel.org>,
stable@vger.kernel.org,
Masayuki Ohtake <masa-korg@dsn.okisemi.com>
Subject: [PATCH 7/8] spi: topcliff-pch: fix controller deregistration
Date: Tue, 14 Apr 2026 15:43:18 +0200 [thread overview]
Message-ID: <20260414134319.978196-8-johan@kernel.org> (raw)
In-Reply-To: <20260414134319.978196-1-johan@kernel.org>
Make sure to deregister the controller before disabling and releasing
underlying resources like interrupts and DMA during driver unbind.
Fixes: e8b17b5b3f30 ("spi/topcliff: Add topcliff platform controller hub (PCH) spi bus driver")
Cc: stable@vger.kernel.org # 2.6.37
Cc: Masayuki Ohtake <masa-korg@dsn.okisemi.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/spi/spi-topcliff-pch.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index cae2dcefabea..c120436434d0 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -1406,6 +1406,10 @@ static void pch_spi_pd_remove(struct platform_device *plat_dev)
dev_dbg(&plat_dev->dev, "%s:[ch%d] irq=%d\n",
__func__, plat_dev->id, board_dat->pdev->irq);
+ spi_controller_get(data->host);
+
+ spi_unregister_controller(data->host);
+
if (use_dma)
pch_free_dma_buf(board_dat, data);
@@ -1433,7 +1437,8 @@ static void pch_spi_pd_remove(struct platform_device *plat_dev)
}
pci_iounmap(board_dat->pdev, data->io_remap_addr);
- spi_unregister_controller(data->host);
+
+ spi_controller_put(data->host);
}
#ifdef CONFIG_PM
static int pch_spi_pd_suspend(struct platform_device *pd_dev,
--
2.52.0
next prev parent reply other threads:[~2026-04-14 13:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260414134319.978196-1-johan@kernel.org>
2026-04-14 13:43 ` [PATCH 1/8] spi: cadence: fix controller deregistration Johan Hovold
2026-04-14 13:43 ` [PATCH 2/8] spi: cadence-quadspi: " Johan Hovold
2026-04-14 13:43 ` [PATCH 3/8] spi: mpc52xx: " Johan Hovold
2026-04-14 13:43 ` [PATCH 4/8] spi: mpc52xx: fix use-after-free on unbind Johan Hovold
2026-04-14 13:43 ` [PATCH 5/8] spi: mxic: fix controller deregistration Johan Hovold
2026-04-14 13:43 ` [PATCH 6/8] spi: orion: " Johan Hovold
2026-04-14 13:43 ` Johan Hovold [this message]
2026-04-14 13:43 ` [PATCH 8/8] spi: topcliff-pch: fix use-after-free on unbind Johan Hovold
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=20260414134319.978196-8-johan@kernel.org \
--to=johan@kernel.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=masa-korg@dsn.okisemi.com \
--cc=stable@vger.kernel.org \
/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