diff mbox series

i2c: gpio: remove error checks with debugfs

Message ID 20230921084016.3434-1-wsa+renesas@sang-engineering.com (mailing list archive)
State Mainlined
Commit 24051338322f096f7bfeff52fddf2aec7cb16191
Delegated to: Geert Uytterhoeven
Headers show
Series i2c: gpio: remove error checks with debugfs | expand

Commit Message

Wolfram Sang Sept. 21, 2023, 8:40 a.m. UTC
debugfs can handle error pointers in subsequent calls. So, remove the
error checks as suggested by kerneldoc of this function.

Reported-by: Minjie Du <duminjie@vivo.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-gpio.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Andi Shyti Sept. 21, 2023, 9:35 p.m. UTC | #1
Hi Wolfram,

[...]

> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index e5a5b9e8bf2c..fb35a75fe0e3 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -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;

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.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi
Geert Uytterhoeven Sept. 22, 2023, 7:35 a.m. UTC | #2
On Thu, Sep 21, 2023 at 11:23 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> debugfs can handle error pointers in subsequent calls. So, remove the
> error checks as suggested by kerneldoc of this function.
>
> Reported-by: Minjie Du <duminjie@vivo.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
Wolfram Sang Sept. 22, 2023, 9:57 a.m. UTC | #3
On Thu, Sep 21, 2023 at 10:40:15AM +0200, Wolfram Sang wrote:
> debugfs can handle error pointers in subsequent calls. So, remove the
> error checks as suggested by kerneldoc of this function.
> 
> Reported-by: Minjie Du <duminjie@vivo.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index e5a5b9e8bf2c..fb35a75fe0e3 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -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);