[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] hw/smbios: retrieve PCI address from specified device
From: |
Vincent Bernat |
Subject: |
Re: [PATCH v2 2/2] hw/smbios: retrieve PCI address from specified device for Type 41 |
Date: |
Thu, 01 Apr 2021 14:27:06 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
❦ 1 avril 2021 10:38 +01, Daniel P. Berrangé:
>> + t->bus_number = pci_dev_bus_num(pdev);
>> + t->device_number = pdev->devfn;
>> + } else {
>> + fprintf(stderr, "%s: cannot find PCI device %s\n",
>> + __func__, t41->pcidev);
>
> This isn't terminating execution which looks like a bug.
>
> Modify this method to have an 'Error **errp' parameter and
> use 'error_setg' to report it. You'll need to modify the
> smbios_get_tables caller to have an 'Error **errp' too.
>
> For the callers of smbios_get_tables(), you can then just pass
> in '&error_fatal', to make it print the error + exit.
I did that. I wanted to also return -1, but it would require to tweak a
bit more code, notably the SMBIOS_BUILD_TABLE_PRE() macro. As the
callers are using error_fatal, I suppose this is not strictly mandatory
to signal the error through a return code.
--
Have a place for everything and keep the thing somewhere else; this is not
advice, it is merely custom.
-- Mark Twain
Re: [PATCH v2 1/2] hw/smbios: support for type 41 (onboard devices extended information), Daniel P . Berrangé, 2021/04/01