diff --git a/common/cmd_cpu.c b/common/cmd_cpu.c
index c3e229f00abc72d2aee589e790750a7e9063b5cc..b4af64f54f9ffa40966ef56c77941adac7fc11f6 100644
--- a/common/cmd_cpu.c
+++ b/common/cmd_cpu.c
@@ -9,6 +9,7 @@
 #include <command.h>
 #include <cpu.h>
 #include <dm.h>
+#include <errno.h>
 
 static const char *cpu_feature_name[CPU_FEAT_COUNT] = {
 	"L1 cache",
diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c
index ab18ee2ea9346415af7ba0924929ac31dfb698a5..aa0267ca03e9c7cf3c37fac47c822e084ba23ec4 100644
--- a/drivers/cpu/cpu-uclass.c
+++ b/drivers/cpu/cpu-uclass.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <cpu.h>
 #include <dm.h>
+#include <errno.h>
 #include <dm/lists.h>
 #include <dm/root.h>