Since debugfs_create_dir() returns ERR_PTR and never return NULL, So use IS_ERR() to check it instead of checking NULL. Fixes: 14911c6f48ec ("i2c: gpio: add fault injector") Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> --- drivers/i2c/busses/i2c-gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index e5a5b9e8bf2c..5ecf35c4a21f 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -265,12 +265,12 @@ static void i2c_gpio_fault_injector_init(struct platform_device *pdev) */ if (!i2c_gpio_debug_dir) { i2c_gpio_debug_dir = debugfs_create_dir("i2c-fault-injector", NULL); - if (!i2c_gpio_debug_dir) + if (IS_ERR(i2c_gpio_debug_dir)) return; } priv->debug_dir = debugfs_create_dir(pdev->name, i2c_gpio_debug_dir); - if (!priv->debug_dir) + if (IS_ERR(priv->debug_dir)) return; init_completion(&priv->scl_irq_completion); -- 2.34.1