diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index d47ba14e47bd..05048c6f787a 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -487,6 +487,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