quoted hunk ↗ jump to hunk
+ bslab->slab = kmem_cache_create(bslab->name, size,
+ ARCH_KMALLOC_MINALIGN, SLAB_HWCACHE_ALIGN, NULL);
+ if (!bslab->slab) {
+ kfree(bslab);
+ return NULL;
}
+ bslab->slab_ref = 1;
+ bslab->slab_size = size;
+
+ if (xa_err(xa_store(&bio_slabs, size, bslab, GFP_KERNEL))) {
+ kmem_cache_destroy(bslab->slab);
+ kfree(bslab);
+ return NULL;
}
+ return bslab;
I'd prefer a label so that the error return and freeing of bslab is
shared between the two error conditions.
Otherwise this looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>