Re: [PATCH v2 05/15] qemu: Simplify modelName stringification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2018-02-19 at 16:06 +0100, Peter Krempa wrote:
> >      case VIR_DOMAIN_CONTROLLER_TYPE_PCI: {
> > -        const virDomainPCIControllerOpts *pciopts;
> > -        const char *modelName = NULL;
> > -
> > -        pciopts = &def->opts.pciopts;
> > -        if (def->model != VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT &&
> > -            def->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST)
> > -            modelName = virDomainControllerPCIModelNameTypeToString(pciopts->modelName);
> > +        const virDomainPCIControllerOpts *pciopts = &def->opts.pciopts;
> > +        const char *modelName = virDomainControllerPCIModelNameTypeToString(pciopts->modelName);
> 
> This is not equivalent. virDomainControllerPCIModelName implementation
> actually defines a string for VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT so
> it will not return NULL and the commit message does not explain why/if
> it is actually okay.

The result doesn't change because the PCIE_ROOT case in the switch
statement immediately following the conversion does nothing but
error out, which makes whether or not modelName is NULL irrelevant.

I can add the explanation above to the commit message if you want.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux