summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-04-29 11:53:27 +0200
committerAlex Williamson <alex.williamson@redhat.com>2021-05-04 17:56:02 +0200
commit698f99ed5e06946764c3be035ce9d62a2691e08c (patch)
tree98ef36167c5b4b7b556bb593f9bfa0c4a3b60c54
parentMerge tag 'for-5.13/parisc' of git://git.kernel.org/pub/scm/linux/kernel/git/... (diff)
downloadlinux-698f99ed5e06946764c3be035ce9d62a2691e08c.tar.xz
linux-698f99ed5e06946764c3be035ce9d62a2691e08c.zip
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: 3d3a360e570616 ("vfio/mbochs: Use mdev_get_type_group_id()") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Message-Id: <20210429095327.GY1981@kadam> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r--samples/vfio-mdev/mbochs.c2
-rw-r--r--samples/vfio-mdev/mdpy.c3
2 files changed, 1 insertions, 4 deletions
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index 861c76914e76..881ef9a7296f 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -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;
diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c
index f0c0e7209719..e889c1cf8fd1 100644
--- a/samples/vfio-mdev/mdpy.c
+++ b/samples/vfio-mdev/mdpy.c
@@ -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);