From cc5be22dfbc6cb76cbb1e73bae7730b2cfc076e5 Mon Sep 17 00:00:00 2001 From: Bowen Yu Date: Wed, 19 Nov 2025 15:53:37 +0800 Subject: [PATCH 1/2] Fix SPI registration failure logging level ANBZ: #28797 commit b4868a06e04e8012a92949439e4ad55da0911050 openeuler driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ID7HUT ---------------------------------------------------------------------- When the SPI controller is registered before GPIO is fully available, the system may fail to acquire necessary resources for the SPI host. Previously, this condition was logged using dev_err(), which unnecessarily elevated the severity of the message, potentially triggering alerts or log analysis systems for what is a normal and expected race condition during device initialization. Fixes: 9f5890466e93 ("spi: hisi-kunpeng: switch to use modern name") Signed-off-by: Bowen Yu Signed-off-by: lujunhua Signed-off-by: zhangxinghao --- drivers/spi/spi-hisi-kunpeng.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c index 16054695bdb0..b49f6aab327a 100644 --- a/drivers/spi/spi-hisi-kunpeng.c +++ b/drivers/spi/spi-hisi-kunpeng.c @@ -18,6 +18,7 @@ #include #include #include +#include /* Register offsets */ #define HISI_SPI_CSCR 0x00 /* cs control register */ @@ -510,10 +511,8 @@ static int hisi_spi_probe(struct platform_device *pdev) } ret = spi_register_controller(host); - if (ret) { - dev_err(dev, "failed to register spi host, ret=%d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "failed to register spi host\n"); if (hisi_spi_debugfs_init(hs)) dev_info(dev, "failed to create debugfs dir\n"); -- Gitee From 2dfd6381b21c2740d977d4007b058a09781e0b98 Mon Sep 17 00:00:00 2001 From: Devyn Liu Date: Mon, 21 Jul 2025 19:26:22 +0800 Subject: [PATCH 2/2] Fixed the wrong debugfs node name in hisi_spi debugfs initialization ANBZ: #28797 commit 9c04e8a224613f439d43cda9afe487e6a0702040 openeuler 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 Signed-off-by: zhangxinghao --- 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 b49f6aab327a..78a35a75fc6e 100644 --- a/drivers/spi/spi-hisi-kunpeng.c +++ b/drivers/spi/spi-hisi-kunpeng.c @@ -165,7 +165,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