提交 698f99ed 编写于 作者: D Dan Carpenter 提交者: Alex Williamson

vfio/mdev: remove unnecessary NULL check in mbochs_create()

Originally "type" could be NULL and these checks were required, but we
recently changed how "type" is assigned and that's no longer the case.
Now "type" points to an element in the middle of a non-NULL array.

Removing the checks does not affect runtime at all, but it makes the
code a little bit simpler to read.

Fixes: 3d3a360e ("vfio/mbochs: Use mdev_get_type_group_id()")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NJason Gunthorpe <jgg@nvidia.com>
Message-Id: <20210429095327.GY1981@kadam>
Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
上级 5e321ded
......@@ -513,8 +513,6 @@ static int mbochs_create(struct mdev_device *mdev)
struct device *dev = mdev_dev(mdev);
struct mdev_state *mdev_state;
if (!type)
type = &mbochs_types[0];
if (type->mbytes + mbochs_used_mbytes > max_mbytes)
return -ENOMEM;
......
......@@ -667,8 +667,7 @@ static ssize_t description_show(struct mdev_type *mtype,
&mdpy_types[mtype_get_type_group_id(mtype)];
return sprintf(buf, "virtual display, %dx%d framebuffer\n",
type ? type->width : 0,
type ? type->height : 0);
type->width, type->height);
}
static MDEV_TYPE_ATTR_RO(description);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册