diff --git a/tools/mm/page_owner_sort.c b/tools/mm/page_owner_sort.c index e6954909401c..904d48931af8 100644 --- a/tools/mm/page_owner_sort.c +++ b/tools/mm/page_owner_sort.c @@ -788,8 +788,7 @@ int main(int argc, char **argv) } fin = fopen(argv[optind], "r"); - fout = fopen(argv[optind + 1], "w"); - if (!fin || !fout) { + if (!fin) { usage(); perror("open: "); exit(1); @@ -826,6 +825,13 @@ int main(int argc, char **argv) goto out_free; } + fout = fopen(argv[optind + 1], "w"); + if (!fout) { + usage(); + perror("open: "); + exit(1); + } + printf("loaded %d\n", list_size); printf("sorting ....\n");