spi: hisi-kunpeng: Fix error checking
authorYeqi Fu <asuk4.q@gmail.com>
Thu, 18 May 2023 05:25:15 +0000 (13:25 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 18 May 2023 10:26:36 +0000 (19:26 +0900)
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@gmail.com
Signed-off-by: Yeqi Fu <asuk4.q@gmail.com
Link: https://lore.kernel.org/r/20230518052515.368978-1-asuk4.q@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org
drivers/spi/spi-hisi-kunpeng.c

index 524eadbef87b310298923449f6ed787860652510..2b4b3d2a22b8ba38fbb65a76b5e1e54f139c5d92 100644 (file)
@@ -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;