Patchwork [2/3] acpica: fwts_acpica: no need to check for null ptr on fwts_low_free

login
register
mail settings
Submitter Colin King
Date June 7, 2013, 8:41 a.m.
Message ID <1370594499-25991-3-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/249621/
State Accepted
Headers show

Comments

Colin King - June 7, 2013, 8:41 a.m.
From: Colin Ian King <colin.king@canonical.com>

fwts_low_free already does a NULL pointer check (like most free's)
so no need to check it is NULL before free'ing.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/fwts_acpica.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Alex Hung - June 10, 2013, 7:45 a.m.
On 06/07/2013 04:41 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> fwts_low_free already does a NULL pointer check (like most free's)
> so no need to check it is NULL before free'ing.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpica/fwts_acpica.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
> index 835685b..42b68f1 100644
> --- a/src/acpica/fwts_acpica.c
> +++ b/src/acpica/fwts_acpica.c
> @@ -1062,10 +1062,7 @@ int fwts_acpica_init(fwts_framework *fw)
>   }
>
>   #define FWTS_ACPICA_FREE(x)	\
> -	if (x) {		\
> -		fwts_low_free(x);	\
> -		x = NULL;	\
> -	}			\
> +	{ fwts_low_free(x); x = NULL; }
>
>   /*
>    *  fwts_acpica_deinit()
>
Acked-by: <alex.hung@canonical.com>
Keng-Yu Lin - June 19, 2013, 7:19 a.m.
On Fri, Jun 7, 2013 at 4:41 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> fwts_low_free already does a NULL pointer check (like most free's)
> so no need to check it is NULL before free'ing.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/fwts_acpica.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
> index 835685b..42b68f1 100644
> --- a/src/acpica/fwts_acpica.c
> +++ b/src/acpica/fwts_acpica.c
> @@ -1062,10 +1062,7 @@ int fwts_acpica_init(fwts_framework *fw)
>  }
>
>  #define FWTS_ACPICA_FREE(x)    \
> -       if (x) {                \
> -               fwts_low_free(x);       \
> -               x = NULL;       \
> -       }                       \
> +       { fwts_low_free(x); x = NULL; }
>
>  /*
>   *  fwts_acpica_deinit()
> --
> 1.8.3
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
index 835685b..42b68f1 100644
--- a/src/acpica/fwts_acpica.c
+++ b/src/acpica/fwts_acpica.c
@@ -1062,10 +1062,7 @@  int fwts_acpica_init(fwts_framework *fw)
 }
 
 #define FWTS_ACPICA_FREE(x)	\
-	if (x) {		\
-		fwts_low_free(x);	\
-		x = NULL;	\
-	}			\
+	{ fwts_low_free(x); x = NULL; }
 
 /*
  *  fwts_acpica_deinit()