Skip to content

Commit 60438d9

Browse files
Lv Zhengrafaeljw
authored andcommitted
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 <[email protected]> Signed-off-by: Lv Zheng <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 9735a22 commit 60438d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/power/acpi/tools/acpidbg/acpidbg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void usage(FILE *file, char *progname)
375375

376376
int main(int argc, char **argv)
377377
{
378-
int fd = 0;
378+
int fd = -1;
379379
int ch;
380380
int len;
381381
int ret = EXIT_SUCCESS;
@@ -430,7 +430,7 @@ int main(int argc, char **argv)
430430
acpi_aml_loop(fd);
431431

432432
exit:
433-
if (fd < 0)
433+
if (fd >= 0)
434434
close(fd);
435435
if (acpi_aml_batch_cmd)
436436
free(acpi_aml_batch_cmd);

0 commit comments

Comments
 (0)