diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index bd9b94b518f39da6e16ca9f080b9d1ce32a95993..fca0c51bbc90c92bb605588840f5bdf9bfdc5c2f 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -22,6 +22,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/kmsg_dump.h>
 #include <linux/time.h>