summary refs log tree commit diff
path: root/pkgs/os-specific/linux/powertop
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/powertop')
-rw-r--r--pkgs/os-specific/linux/powertop/auto-tune.patch11
-rw-r--r--pkgs/os-specific/linux/powertop/default.nix6
2 files changed, 16 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/powertop/auto-tune.patch b/pkgs/os-specific/linux/powertop/auto-tune.patch
new file mode 100644
index 00000000000..c9095336e8d
--- /dev/null
+++ b/pkgs/os-specific/linux/powertop/auto-tune.patch
@@ -0,0 +1,11 @@
+diff --git a/src/devices/devfreq.cpp b/src/devices/devfreq.cpp
+index d2e56e3..4de5c9b 100644
+--- a/src/devices/devfreq.cpp
++++ b/src/devices/devfreq.cpp
+@@ -247,6 +247,7 @@ void create_all_devfreq_devices(void)
+ 		fprintf(stderr, "Devfreq not enabled\n");
+ 		is_enabled = false;
+ 		closedir(dir);
++		dir = NULL;
+ 		return;
+ 	}
diff --git a/pkgs/os-specific/linux/powertop/default.nix b/pkgs/os-specific/linux/powertop/default.nix
index 9e32cd70cfb..82ca746d6a4 100644
--- a/pkgs/os-specific/linux/powertop/default.nix
+++ b/pkgs/os-specific/linux/powertop/default.nix
@@ -10,7 +10,11 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gettext libnl ncurses pciutils pkgconfig zlib ];
 
-  patchPhase = ''
+  # Fix --auto-tune bug:
+  # https://lists.01.org/pipermail/powertop/2014-December/001727.html
+  patches = [ ./auto-tune.patch ];
+
+  postPatch = ''
     substituteInPlace src/main.cpp --replace "/sbin/modprobe" "modprobe"
   '';