From c1ecc3db576f186b8b25bade91d7d5d60f22b372 Mon Sep 17 00:00:00 2001 From: Devyn Liu Date: Mon, 21 Jul 2025 19:26:22 +0800 Subject: [PATCH] Fixed the wrong debugfs node name in hisi_spi debugfs initialization driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICOAO3 CVE: NA -------------------------------- in hisi_spi_debugfs_init, spi controller pointer is calculated by container_of macro, and the member is hs->dev. But the host pointer cannot be calculated offset directly by this, because hs->dev points to the device in platform device(pdev->dev), and the host->dev points to the pdev->dev.parent. In this patch, this issues is fixed by getting the controller data from pdev->dev.driver_data directly, driver_data points to the spi controller data in the probe stage. Fixes: 20af5164c223 ("spi: hisi-kunpeng: switch to use modern name") Signed-off-by: lujunhua Signed-off-by: Devyn Liu --- drivers/spi/spi-hisi-kunpeng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c index bc35f5ad02db..83afa4180747 100644 --- a/drivers/spi/spi-hisi-kunpeng.c +++ b/drivers/spi/spi-hisi-kunpeng.c @@ -164,7 +164,7 @@ static int hisi_spi_debugfs_init(struct hisi_spi *hs) struct spi_controller *host; - host = container_of(hs->dev, struct spi_controller, dev); + host = hs->dev->driver_data; snprintf(name, 32, "hisi_spi%d", host->bus_num); hs->debugfs = debugfs_create_dir(name, NULL); if (IS_ERR(hs->debugfs)) -- Gitee