diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 792735c08af7..91cfcc6561e9 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -475,6 +475,10 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size, else va = ioremap_wc(start, size); + /* We must release the mem region if ioremap fails. */ + if (!va) + release_mem_region(start, size); + /* * Since request_mem_region() and ioremap() are byte-granularity * there is no need handle anything special like we do when the