pNFS: Handle allocation errors correctly in objlayout_alloc_layout_hdr()
Return the NULL pointer when the allocation fails. Cc: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
6df200f5d5
commit
0aa61e78a0
|
@ -53,10 +53,10 @@ objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
|
||||||
struct objlayout *objlay;
|
struct objlayout *objlay;
|
||||||
|
|
||||||
objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
|
objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
|
||||||
if (objlay) {
|
if (!objlay)
|
||||||
|
return NULL;
|
||||||
spin_lock_init(&objlay->lock);
|
spin_lock_init(&objlay->lock);
|
||||||
INIT_LIST_HEAD(&objlay->err_list);
|
INIT_LIST_HEAD(&objlay->err_list);
|
||||||
}
|
|
||||||
dprintk("%s: Return %p\n", __func__, objlay);
|
dprintk("%s: Return %p\n", __func__, objlay);
|
||||||
return &objlay->pnfs_layout;
|
return &objlay->pnfs_layout;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue