* [PATCH v4] i2c: gpio: Fix an error check in i2c_gpio_fault_injector_init()
@ 2023-07-13 10:18 Minjie Du
2023-08-14 15:59 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Minjie Du @ 2023-07-13 10:18 UTC (permalink / raw)
To: Wolfram Sang, Andi Shyti, open list:I2C SUBSYSTEM HOST DRIVERS,
open list
Cc: opensource.kernel, Minjie Du, stable
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;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v4] i2c: gpio: Fix an error check in i2c_gpio_fault_injector_init()
2023-07-13 10:18 [PATCH v4] i2c: gpio: Fix an error check in i2c_gpio_fault_injector_init() Minjie Du
@ 2023-08-14 15:59 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2023-08-14 15:59 UTC (permalink / raw)
To: Minjie Du
Cc: Andi Shyti, open list:I2C SUBSYSTEM HOST DRIVERS, open list,
opensource.kernel, stable
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
> - if (!i2c_gpio_debug_dir)
> + if (IS_ERR(i2c_gpio_debug_dir))
> return;
AFAIK, the trend is to remove error checking from debugfs calls. It is
debug only anyhow. No need to bail out. But please double check.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-14 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-13 10:18 [PATCH v4] i2c: gpio: Fix an error check in i2c_gpio_fault_injector_init() Minjie Du
2023-08-14 15:59 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).