Patchwork acpi: fan: fix cur_state comparison bugs

login
register
mail settings
Submitter Colin King
Date May 7, 2013, 9:14 a.m.
Message ID <1367918081-19096-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/242086/
State Accepted
Headers show

Comments

Colin King - May 7, 2013, 9:14 a.m.
From: Colin Ian King <colin.king@canonical.com>

Coverity CID #997309: Same on both sides (CONSTANT_EXPRESSION_RESULT)

Fix stupid typos where we are comparing info2->cur_state with itself
rather than info1->cur_state.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/fan/fan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Alex Hung - May 9, 2013, 5:48 a.m.
On 05/07/2013 05:14 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997309: Same on both sides (CONSTANT_EXPRESSION_RESULT)
>
> Fix stupid typos where we are comparing info2->cur_state with itself
> rather than info1->cur_state.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/fan/fan.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpi/fan/fan.c b/src/acpi/fan/fan.c
> index 184da1a..3e61259 100644
> --- a/src/acpi/fan/fan.c
> +++ b/src/acpi/fan/fan.c
> @@ -216,13 +216,13 @@ static int fan_test2(fwts_framework *fw)
>   							info1->name, info1->cur_state, info2->cur_state);
>   							changed = true;
>   					}
> -					if (info2->cur_state > info2->cur_state) {
> +					if (info2->cur_state > info1->cur_state) {
>   						fwts_passed(fw, "Fan %s current state increased from %d to %d "
>   							"while CPUs were busy.",
>   							info1->name, info1->cur_state, info2->cur_state);
>   							changed = true;
>   					}
> -					if (info2->cur_state == info2->cur_state)
> +					if (info2->cur_state == info1->cur_state)
>   						fwts_log_info(fw, "Fan %s current state did not change from value %d "
>   							"while CPUs were busy.",
>   							info1->name, info1->cur_state);
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin - May 20, 2013, 7:41 a.m.
On Tue, May 7, 2013 at 5:14 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997309: Same on both sides (CONSTANT_EXPRESSION_RESULT)
>
> Fix stupid typos where we are comparing info2->cur_state with itself
> rather than info1->cur_state.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/fan/fan.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpi/fan/fan.c b/src/acpi/fan/fan.c
> index 184da1a..3e61259 100644
> --- a/src/acpi/fan/fan.c
> +++ b/src/acpi/fan/fan.c
> @@ -216,13 +216,13 @@ static int fan_test2(fwts_framework *fw)
>                                                         info1->name, info1->cur_state, info2->cur_state);
>                                                         changed = true;
>                                         }
> -                                       if (info2->cur_state > info2->cur_state) {
> +                                       if (info2->cur_state > info1->cur_state) {
>                                                 fwts_passed(fw, "Fan %s current state increased from %d to %d "
>                                                         "while CPUs were busy.",
>                                                         info1->name, info1->cur_state, info2->cur_state);
>                                                         changed = true;
>                                         }
> -                                       if (info2->cur_state == info2->cur_state)
> +                                       if (info2->cur_state == info1->cur_state)
>                                                 fwts_log_info(fw, "Fan %s current state did not change from value %d "
>                                                         "while CPUs were busy.",
>                                                         info1->name, info1->cur_state);
> --
> 1.8.1.2
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/acpi/fan/fan.c b/src/acpi/fan/fan.c
index 184da1a..3e61259 100644
--- a/src/acpi/fan/fan.c
+++ b/src/acpi/fan/fan.c
@@ -216,13 +216,13 @@  static int fan_test2(fwts_framework *fw)
 							info1->name, info1->cur_state, info2->cur_state);
 							changed = true;
 					}
-					if (info2->cur_state > info2->cur_state) {
+					if (info2->cur_state > info1->cur_state) {
 						fwts_passed(fw, "Fan %s current state increased from %d to %d "
 							"while CPUs were busy.",
 							info1->name, info1->cur_state, info2->cur_state);
 							changed = true;
 					}
-					if (info2->cur_state == info2->cur_state)
+					if (info2->cur_state == info1->cur_state)
 						fwts_log_info(fw, "Fan %s current state did not change from value %d "
 							"while CPUs were busy.",
 							info1->name, info1->cur_state);