aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio/pci
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2014-05-30 13:35:53 -0400
committerAlex Williamson <alex.williamson@redhat.com>2014-05-30 13:35:53 -0400
commiteb5685f0de4702e44a8b262f1acaea52ef99271a (patch)
tree9705ff6180e6074a36150c41ce61bbc531f412f7 /drivers/vfio/pci
parentafa63252b2ab85614929405971105c3b20d675ba (diff)
vfio/pci: Fix unchecked return value
There's nothing we can do different if pci_load_and_free_saved_state() fails, other than maybe print some log message, but the actual re-load of the state is an unnecessary step here since we've only just saved it. We can cleanup a coverity warning and eliminate the unnecessary step by freeing the state ourselves. Detected by Coverity: CID 753101 Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/pci')
-rw-r--r--drivers/vfio/pci/vfio_pci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 7ba042498857..85063f1c12d7 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -57,7 +57,8 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev)
57 57
58 ret = vfio_config_init(vdev); 58 ret = vfio_config_init(vdev);
59 if (ret) { 59 if (ret) {
60 pci_load_and_free_saved_state(pdev, &vdev->pci_saved_state); 60 kfree(vdev->pci_saved_state);
61 vdev->pci_saved_state = NULL;
61 pci_disable_device(pdev); 62 pci_disable_device(pdev);
62 return ret; 63 return ret;
63 } 64 }