diff mbox

dmi: dmicheck: remove redundant check on boolean advice_given

Message ID 20170413101946.19316-1-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King April 13, 2017, 10:19 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The boolean advice_given is always false, so the !advice_given is
always true. We can remove this redundant variable and check.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/dmi/dmicheck/dmicheck.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Alex Hung April 17, 2017, 5:31 p.m. UTC | #1
On 2017-04-13 03:19 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The boolean advice_given is always false, so the !advice_given is
> always true. We can remove this redundant variable and check.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 49b523db..25fc678c 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -990,7 +990,6 @@ static void dmicheck_entry(fwts_framework *fw,
>  	uint32_t failed_count = fw->minor_tests.failed;
>  	int	battery_count;
>  	int	ret;
> -	bool	advice_given = false;
>
>  	switch (hdr->type) {
>  		case 0: /* 7.1 */
> @@ -1652,7 +1651,7 @@ static void dmicheck_entry(fwts_framework *fw,
>  	}
>  	if (fw->minor_tests.failed == failed_count)
>  		fwts_passed(fw, "Entry @ 0x%8.8" PRIx32 " '%s'", addr, table);
> -	else if (!advice_given && hdr->type <= 42)
> +	else if (hdr->type <= 42)
>  		fwts_advice(fw,
>  			"It may be worth checking against section 7.%" PRId8 " of the "
>  			"System Management BIOS (SMBIOS) Reference Specification "
>


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu April 21, 2017, 2:49 a.m. UTC | #2
On 04/13/2017 06:19 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The boolean advice_given is always false, so the !advice_given is
> always true. We can remove this redundant variable and check.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index 49b523db..25fc678c 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -990,7 +990,6 @@ static void dmicheck_entry(fwts_framework *fw,
>  	uint32_t failed_count = fw->minor_tests.failed;
>  	int	battery_count;
>  	int	ret;
> -	bool	advice_given = false;
>
>  	switch (hdr->type) {
>  		case 0: /* 7.1 */
> @@ -1652,7 +1651,7 @@ static void dmicheck_entry(fwts_framework *fw,
>  	}
>  	if (fw->minor_tests.failed == failed_count)
>  		fwts_passed(fw, "Entry @ 0x%8.8" PRIx32 " '%s'", addr, table);
> -	else if (!advice_given && hdr->type <= 42)
> +	else if (hdr->type <= 42)
>  		fwts_advice(fw,
>  			"It may be worth checking against section 7.%" PRId8 " of the "
>  			"System Management BIOS (SMBIOS) Reference Specification "
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
index 49b523db..25fc678c 100644
--- a/src/dmi/dmicheck/dmicheck.c
+++ b/src/dmi/dmicheck/dmicheck.c
@@ -990,7 +990,6 @@  static void dmicheck_entry(fwts_framework *fw,
 	uint32_t failed_count = fw->minor_tests.failed;
 	int	battery_count;
 	int	ret;
-	bool	advice_given = false;
 
 	switch (hdr->type) {
 		case 0: /* 7.1 */
@@ -1652,7 +1651,7 @@  static void dmicheck_entry(fwts_framework *fw,
 	}
 	if (fw->minor_tests.failed == failed_count)
 		fwts_passed(fw, "Entry @ 0x%8.8" PRIx32 " '%s'", addr, table);
-	else if (!advice_given && hdr->type <= 42)
+	else if (hdr->type <= 42)
 		fwts_advice(fw,
 			"It may be worth checking against section 7.%" PRId8 " of the "
 			"System Management BIOS (SMBIOS) Reference Specification "