| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * POWER Data Stream Control Register (DSCR) sysfs interface test |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * well verified from their sysfs interfaces. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Copyright 2015, Anshuman Khandual, IBM Corporation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 11 | | - * under the terms of the GNU General Public License version 2 as published |
|---|
| 12 | | - * by the Free Software Foundation. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | #include "dscr.h" |
|---|
| 15 | 12 | |
|---|
| .. | .. |
|---|
| 27 | 24 | rc = read(fd, buf, sizeof(buf)); |
|---|
| 28 | 25 | if (rc == -1) { |
|---|
| 29 | 26 | perror("read() failed"); |
|---|
| 27 | + close(fd); |
|---|
| 30 | 28 | return 1; |
|---|
| 31 | 29 | } |
|---|
| 32 | 30 | close(fd); |
|---|
| .. | .. |
|---|
| 68 | 66 | if (access(file, F_OK)) |
|---|
| 69 | 67 | continue; |
|---|
| 70 | 68 | |
|---|
| 71 | | - if (check_cpu_dscr_default(file, val)) |
|---|
| 69 | + if (check_cpu_dscr_default(file, val)) { |
|---|
| 70 | + closedir(sysfs); |
|---|
| 72 | 71 | return 1; |
|---|
| 72 | + } |
|---|
| 73 | 73 | } |
|---|
| 74 | 74 | closedir(sysfs); |
|---|
| 75 | 75 | return 0; |
|---|
| .. | .. |
|---|
| 80 | 80 | unsigned long orig_dscr_default; |
|---|
| 81 | 81 | int i, j; |
|---|
| 82 | 82 | |
|---|
| 83 | + SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR)); |
|---|
| 84 | + |
|---|
| 83 | 85 | orig_dscr_default = get_default_dscr(); |
|---|
| 84 | 86 | for (i = 0; i < COUNT; i++) { |
|---|
| 85 | 87 | for (j = 0; j < DSCR_MAX; j++) { |
|---|