1
0
Fork 0

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>
hifive-unleashed-5.1
Lv Zheng 2016-03-24 13:01:28 +08:00 committed by Rafael J. Wysocki
parent 9735a22799
commit 60438d9a1e
1 changed files with 2 additions and 2 deletions

View File

@ -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);