提交 1d29b5b0 编写于 作者: F Fam Zheng 提交者: Michael Tokarev

virtio-blk: Remove useless condition around g_free()

Laszlo spotted and studied this wasteful "if". He pointed out:

The original virtio_blk_free_request needed an "if" as it accesses one
field, since 671ec3f0 ("virtio-blk: Convert VirtIOBlockReq.elem to
pointer", 2014-06-11); later on in f897bf75 ("virtio-blk: embed
VirtQueueElement in VirtIOBlockReq", 2014-07-09) the field became
embedded, so the "if" became unnecessary (at which point we were using
g_slice_free(), but it is the same.

Now drop it.
Reported-by: NLaszlo Ersek <lersek@redhat.com>
Signed-off-by: NFam Zheng <famz@redhat.com>
Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 3ba34a70
......@@ -42,9 +42,7 @@ static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
static void virtio_blk_free_request(VirtIOBlockReq *req)
{
if (req) {
g_free(req);
}
g_free(req);
}
static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册