summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/base/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/base/memory.c')
-rw-r--r--kernel/drivers/base/memory.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/drivers/base/memory.c b/kernel/drivers/base/memory.c
index 2804aed3f..25425d3f2 100644
--- a/kernel/drivers/base/memory.c
+++ b/kernel/drivers/base/memory.c
@@ -303,6 +303,10 @@ static int memory_subsys_offline(struct device *dev)
if (mem->state == MEM_OFFLINE)
return 0;
+ /* Can't offline block with non-present sections */
+ if (mem->section_count != sections_per_block)
+ return -EINVAL;
+
return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE);
}