[PATCH][nandsim]Fix RAM wasting via kmalloc (take 2)

Alexey Korolev akorolev at infradead.org
Thu Nov 13 08:21:52 EST 2008


> Would you please send a version which checks return pointer of
> kmem_cache_alloc() for NULL?
I think it is  unnecessary to add one more check of return pointer for NULL
after kmem_cache_alloc() function.

PLease take a look at these lines of the patch:
-		mypage->byte = kmalloc(ns->geom.pgszoob, GFP_NOFS);
+		mypage->byte = kmem_cache_alloc(ns->nand_pages_slab, GFP_NOFS);
 		if (mypage->byte == NULL) {
 			NS_ERR("prog_page: error allocating memory for page %d\n", ns->regs.row);
 			return -1;
If I properly understand the code it already performs checking just after attempt of allocation. 
So this patch version should be correct.


More information about the linux-mtd mailing list