* [Powertop] closedir patch
@ 2020-04-21 6:18 Michael Vetter
0 siblings, 0 replies; only message in thread
From: Michael Vetter @ 2020-04-21 6:18 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 184 bytes --]
In case `dir` is NULL we should not call `closedir()` since it's
behaviour is implementation specific.
Patch attached. Please apply with `git am <
powertop-only-closedir.patch`.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: powertop-only-closedir.patch --]
[-- Type: text/x-patch, Size: 916 bytes --]
From 553294813635c074230a9d8ba0d7736c23f15ddd Mon Sep 17 00:00:00 2001
From: Michael Vetter <jubalh@iodoru.org>
Date: Tue, 3 Sep 2019 12:56:04 +0200
Subject: [PATCH] intel_cpus.cpp: Only call closedir() if opened
In case `dir` is NULL we should not call `closedir()` since it's
behaviour is implementation specific.
---
src/cpu/intel_cpus.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
index 4dffadc..af473ee 100644
--- a/src/cpu/intel_cpus.cpp
+++ b/src/cpu/intel_cpus.cpp
@@ -142,11 +142,12 @@ intel_util::intel_util()
void intel_util::byt_has_ahci()
{
dir = opendir("/sys/bus/pci/devices/0000:00:13.0");
- if (!dir)
- byt_ahci_support=0;
- else
+ if (!dir)
+ byt_ahci_support=0;
+ else {
byt_ahci_support=1;
- closedir(dir);
+ closedir(dir);
+ }
}
int intel_util::get_byt_ahci_support()
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-21 6:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-21 6:18 [Powertop] closedir patch Michael Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox