From: Pan Bian Date: Sun, 29 Oct 2017 12:40:02 +0000 (+0800) Subject: ubi: fastmap: Use kmem_cache_free to deallocate memory X-Git-Tag: v4.16-rc1~183^2~12 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=af7bcee27652bbf2502207500ad200763707a160;p=users%2Fwilly%2Fxarray.git ubi: fastmap: Use kmem_cache_free to deallocate memory Memory allocated by kmem_cache_alloc() should not be deallocated with kfree(). Use kmem_cache_free() instead. Signed-off-by: Pan Bian Reviewed-by: Boris Brezillon Signed-off-by: Richard Weinberger --- diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 5a832bc79b1b..717db749808a 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -1063,7 +1063,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai, e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); if (!e) { while (i--) - kfree(fm->e[i]); + kmem_cache_free(ubi_wl_entry_slab, fm->e[i]); ret = -ENOMEM; goto free_hdr;