mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
virtio-blk: fix NULL checking in virtblk_alloc_req()
Smatch complains about the inconsistent NULL checking here. Fix it to return NULL on failure. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (fixed accidental deletion)
This commit is contained in:
parent
c85a1f91b3
commit
f22cf8eb48
1 changed files with 4 additions and 2 deletions
|
@ -90,10 +90,12 @@ static inline struct virtblk_req *virtblk_alloc_req(struct virtio_blk *vblk,
|
|||
struct virtblk_req *vbr;
|
||||
|
||||
vbr = mempool_alloc(vblk->pool, gfp_mask);
|
||||
if (vbr && use_bio)
|
||||
sg_init_table(vbr->sg, vblk->sg_elems);
|
||||
if (!vbr)
|
||||
return NULL;
|
||||
|
||||
vbr->vblk = vblk;
|
||||
if (use_bio)
|
||||
sg_init_table(vbr->sg, vblk->sg_elems);
|
||||
|
||||
return vbr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue