Skip to contentSkip to conversation

i2c: gpio: remove error checks with debugfs

PATCH Applied Wolfram Sang 3 participants 4 messages Sep 21, 2023 – Sep 22, 2023

Subsystems (2)
lore
Share & tools
lore

Wolfram Sang

author maintainer
#0 lore raw

PATCH 1/1 i2c: gpio: remove error checks with debugfs

debugfs can handle error pointers in subsequent calls. So, remove the error checks as suggested by kerneldoc of this function.

---
 drivers/i2c/busses/i2c-gpio.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/i2c/busses/i2c-gpio.c +1 -6
index e5a5b9e8bf2c..fb35a75fe0e3 100644
@@ -263,15 +263,10 @@ static void i2c_gpio_fault_injector_init(struct platform_device *pdev)
 	 * 'fault-injector' dir there. Until then, we have a global dir with
 	 * all adapters as subdirs.
 	 */
-	if (!i2c_gpio_debug_dir) {
+	if (!i2c_gpio_debug_dir)
 		i2c_gpio_debug_dir = debugfs_create_dir("i2c-fault-injector", NULL);
-		if (!i2c_gpio_debug_dir)
-			return;
-	}
 
 	priv->debug_dir = debugfs_create_dir(pdev->name, i2c_gpio_debug_dir);
-	if (!priv->debug_dir)
-		return;
 
 	init_completion(&priv->scl_irq_completion);
 
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Wolfram,

[...]

Quoted 8 lines
drivers/i2c/busses/i2c-gpio.c +0 -0
index e5a5b9e8bf2c..fb35a75fe0e3 100644
@@ -263,15 +263,10 @@ static void i2c_gpio_fault_injector_init(struct platform_device *pdev)
 	 * 'fault-injector' dir there. Until then, we have a global dir with
 	 * all adapters as subdirs.
 	 */

drivers/i2c/busses/i2c-gpio.c static void i2c_gpio_fault_injector_init(struct platform_device *pdev) · line 274

Quoted 10 lines
drivers/i2c/busses/i2c-gpio.c +1 -6
-	if (!i2c_gpio_debug_dir) {
+	if (!i2c_gpio_debug_dir)
 		i2c_gpio_debug_dir = debugfs_create_dir("i2c-fault-injector", NULL);
-		if (!i2c_gpio_debug_dir)
-			return;
-	}
 
 	priv->debug_dir = debugfs_create_dir(pdev->name, i2c_gpio_debug_dir);
-	if (!priv->debug_dir)
-		return;

nice... this reminds me of some more cleanups that needs to be done elsewhere.

Another good thing that comes out from this patch is that if a debgufs entry is not created it's not a big deal and we shouldn't return but move ahead with the function execution.

Andi

Reviewed-by on v1 1/1
#2 lore raw
In reply to Wolfram Sang
Quoted 5 lines · Wolfram Sang

debugfs can handle error pointers in subsequent calls. So, remove the error checks as suggested by kerneldoc of this function.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds