vfio/pci-quirks: Make vfio_pci_igd_opregion_init() return bool

This is to follow the coding standand in qapi/error.h to return bool
for bool-valued functions.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Zhenzhong Duan 2024-05-22 12:40:10 +08:00 committed by Cédric Le Goater
parent 514855e18f
commit d3c6a18bc7
4 changed files with 9 additions and 11 deletions

View file

@ -502,8 +502,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
} }
/* Setup OpRegion access */ /* Setup OpRegion access */
ret = vfio_pci_igd_opregion_init(vdev, opregion, &err); if (!vfio_pci_igd_opregion_init(vdev, opregion, &err)) {
if (ret) {
error_append_hint(&err, "IGD legacy mode disabled\n"); error_append_hint(&err, "IGD legacy mode disabled\n");
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name); error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
goto out; goto out;

View file

@ -1169,8 +1169,8 @@ static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr)
* the table and to write the base address of that memory to the ASLS register * the table and to write the base address of that memory to the ASLS register
* of the IGD device. * of the IGD device.
*/ */
int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev, bool vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
struct vfio_region_info *info, Error **errp) struct vfio_region_info *info, Error **errp)
{ {
int ret; int ret;
@ -1181,7 +1181,7 @@ int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
error_setg(errp, "failed to read IGD OpRegion"); error_setg(errp, "failed to read IGD OpRegion");
g_free(vdev->igd_opregion); g_free(vdev->igd_opregion);
vdev->igd_opregion = NULL; vdev->igd_opregion = NULL;
return -EINVAL; return false;
} }
/* /*
@ -1206,7 +1206,7 @@ int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
pci_set_long(vdev->pdev.wmask + IGD_ASLS, ~0); pci_set_long(vdev->pdev.wmask + IGD_ASLS, ~0);
pci_set_long(vdev->emulated_config_bits + IGD_ASLS, ~0); pci_set_long(vdev->emulated_config_bits + IGD_ASLS, ~0);
return 0; return true;
} }
/* /*

View file

@ -3161,8 +3161,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
goto out_teardown; goto out_teardown;
} }
ret = vfio_pci_igd_opregion_init(vdev, opregion, errp); if (!vfio_pci_igd_opregion_init(vdev, opregion, errp)) {
if (ret) {
goto out_teardown; goto out_teardown;
} }
} }

View file

@ -227,9 +227,9 @@ int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice *vdev,
bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp); bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp);
int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev, bool vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
struct vfio_region_info *info, struct vfio_region_info *info,
Error **errp); Error **errp);
void vfio_display_reset(VFIOPCIDevice *vdev); void vfio_display_reset(VFIOPCIDevice *vdev);
bool vfio_display_probe(VFIOPCIDevice *vdev, Error **errp); bool vfio_display_probe(VFIOPCIDevice *vdev, Error **errp);