Skip to content

Commit

Permalink
vfio/pci: Fix unchecked return value
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Williamson committed May 30, 2014
1 parent afa6325 commit eb5685f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/vfio/pci/vfio_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev)

ret = vfio_config_init(vdev);
if (ret) {
pci_load_and_free_saved_state(pdev, &vdev->pci_saved_state);
kfree(vdev->pci_saved_state);
vdev->pci_saved_state = NULL;
pci_disable_device(pdev);
return ret;
}
Expand Down

0 comments on commit eb5685f

Please sign in to comment.