debugfs_create_dir() function returns an error value embedded in the pointer (PTR_ERR). Evaluate the return value using IS_ERR rather than checking for NULL.
Fixes: 14911c6f48ec ("i2c: gpio: add fault injector") Cc: Wolfram Sang wsa+renesas@sang-engineering.com Cc: stable@vger.kernel.org # v4.16+ Signed-off-by: Minjie Du duminjie@vivo.com Reviewed-by: Andi Shyti andi.shyti@kernel.org --- v1-v2: Fix judge typo. v2-v3: Add tags. v3-v4: Fix log content. --- drivers/i2c/busses/i2c-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index e5a5b9e8b..545927b96 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -265,7 +265,7 @@ 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; }
linux-stable-mirror@lists.linaro.org