[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230518052515.368978-1-asuk4.q@gmail.com>
Date: Thu, 18 May 2023 13:25:15 +0800
From: Yeqi Fu <asuk4.q@...il.com>
To: f.fangjian@...wei.com, broonie@...nel.org
Cc: Yeqi Fu <asuk4.q@...il.com>, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org, Ivan Orlov <ivan.orlov0322@...il.com>
Subject: [PATCH] spi: hisi-kunpeng: Fix error checking
The function debugfs_create_dir returns ERR_PTR if an error occurs,
and the appropriate way to verify for errors is to use the inline
function IS_ERR. The patch will substitute the null-comparison with
IS_ERR.
Suggested-by: Ivan Orlov <ivan.orlov0322@...il.com>
Signed-off-by: Yeqi Fu <asuk4.q@...il.com>
---
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 524eadbef87b..2b4b3d2a22b8 100644
--- a/drivers/spi/spi-hisi-kunpeng.c
+++ b/drivers/spi/spi-hisi-kunpeng.c
@@ -169,7 +169,7 @@ static int hisi_spi_debugfs_init(struct hisi_spi *hs)
master = container_of(hs->dev, struct spi_controller, dev);
snprintf(name, 32, "hisi_spi%d", master->bus_num);
hs->debugfs = debugfs_create_dir(name, NULL);
- if (!hs->debugfs)
+ if (IS_ERR(hs->debugfs))
return -ENOMEM;
hs->regset.regs = hisi_spi_regs;
--
2.37.2
Powered by blists - more mailing lists