diff options
author | Lv Zheng <lv.zheng@intel.com> | 2016-03-24 06:01:28 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-04-09 03:08:40 +0200 |
commit | 60438d9a1ef4176d79739efadee122afe92904b8 (patch) | |
tree | 6dbb238ffd64d75bb487e10e47557ef7e4ba6e10 /tools/power | |
parent | Linux 4.6-rc2 (diff) | |
download | linux-60438d9a1ef4176d79739efadee122afe92904b8.tar.xz linux-60438d9a1ef4176d79739efadee122afe92904b8.zip |
tools/power/acpi: close file only if it is open
The logic on the test for a valid fd to close is incorrect.
This was just a mistake and was pointed out by Colin Ian King.
Link: https://patchwork.kernel.org/patch/8620201/
Original-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r-- | tools/power/acpi/tools/acpidbg/acpidbg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/power/acpi/tools/acpidbg/acpidbg.c b/tools/power/acpi/tools/acpidbg/acpidbg.c index d070fccdba6d..a88ac45b7756 100644 --- a/tools/power/acpi/tools/acpidbg/acpidbg.c +++ b/tools/power/acpi/tools/acpidbg/acpidbg.c @@ -375,7 +375,7 @@ void usage(FILE *file, char *progname) int main(int argc, char **argv) { - int fd = 0; + int fd = -1; int ch; int len; int ret = EXIT_SUCCESS; @@ -430,7 +430,7 @@ int main(int argc, char **argv) acpi_aml_loop(fd); exit: - if (fd < 0) + if (fd >= 0) close(fd); if (acpi_aml_batch_cmd) free(acpi_aml_batch_cmd); |