lkml.org 
[lkml]   [2019]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 5/5] vfio/pci: Drop duplicate check for size parameter of memremap()
Date
Since memremap() returns NULL pointer for size = 0, there is no need
to duplicate this check in the callers.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/vfio/pci/vfio_pci_igd.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_igd.c b/drivers/vfio/pci/vfio_pci_igd.c
index 53d97f459252..3088a33af271 100644
--- a/drivers/vfio/pci/vfio_pci_igd.c
+++ b/drivers/vfio/pci/vfio_pci_igd.c
@@ -75,13 +75,7 @@ static int vfio_pci_igd_opregion_init(struct vfio_pci_device *vdev)
return -EINVAL;
}

- size = le32_to_cpu(*(__le32 *)(base + 16));
- if (!size) {
- memunmap(base);
- return -EINVAL;
- }
-
- size *= 1024; /* In KB */
+ size = le32_to_cpu(*(__le32 *)(base + 16)) * 1024; /* In KB */

if (size != OPREGION_SIZE) {
memunmap(base);
--
2.24.0
\
 
 \ /
  Last update: 2019-11-15 19:01    [W:0.043 / U:8.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site