Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f22cf8eb authored by Dan Carpenter's avatar Dan Carpenter Committed by Rusty Russell
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (fixed accidental deletion)
parent c85a1f91
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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;
}