diff mbox series

[1/1] clk: kendryte: no need to check argument of free()

Message ID 20200929195212.58695-1-xypron.glpk@gmx.de
State New
Delegated to: Andes
Headers show
Series [1/1] clk: kendryte: no need to check argument of free() | expand

Commit Message

Heinrich Schuchardt Sept. 29, 2020, 7:52 p.m. UTC
free() checks if its argument is NULL. No need to check it twice.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/clk/kendryte/clk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
2.28.0

Comments

Sean Anderson Sept. 29, 2020, 8:06 p.m. UTC | #1
On 9/29/20 3:52 PM, Heinrich Schuchardt wrote:
> free() checks if its argument is NULL. No need to check it twice.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/clk/kendryte/clk.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/kendryte/clk.c b/drivers/clk/kendryte/clk.c
> index 981b3b7699..26139fd804 100644
> --- a/drivers/clk/kendryte/clk.c
> +++ b/drivers/clk/kendryte/clk.c
> @@ -471,8 +471,7 @@ cleanup_gate:
>  cleanup_div:
>  	free(div);
>  cleanup_mux:
> -	if (mux)
> -		free(mux);
> +	free(mux);
>  	return comp;
>  }
> 
> --
> 2.28.0
> 

LGTM

Reviewed-by: Sean Anderson <seanga2@gmail.com>
diff mbox series

Patch

diff --git a/drivers/clk/kendryte/clk.c b/drivers/clk/kendryte/clk.c
index 981b3b7699..26139fd804 100644
--- a/drivers/clk/kendryte/clk.c
+++ b/drivers/clk/kendryte/clk.c
@@ -471,8 +471,7 @@  cleanup_gate:
 cleanup_div:
 	free(div);
 cleanup_mux:
-	if (mux)
-		free(mux);
+	free(mux);
 	return comp;
 }