[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/40] pci: pci_add_option_rom(): improve style
|
From: |
Michael S. Tsirkin |
|
Subject: |
[PULL 16/40] pci: pci_add_option_rom(): improve style |
|
Date: |
Fri, 19 May 2023 10:51:00 -0400 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Fix over-80 lines and missing curly brackets for if-operators, which
are required by QEMU coding style.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20230515125229.44836-2-vsementsov@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
---
hw/pci/pci.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 8a87ccc8b0..e26e2a7e65 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2312,10 +2312,9 @@ static void pci_add_option_rom(PCIDevice *pdev, bool
is_default_rom,
char name[32];
const VMStateDescription *vmsd;
- if (!pdev->romfile)
- return;
- if (strlen(pdev->romfile) == 0)
+ if (!pdev->romfile || !strlen(pdev->romfile)) {
return;
+ }
if (!pdev->rom_bar) {
/*
@@ -2364,7 +2363,8 @@ static void pci_add_option_rom(PCIDevice *pdev, bool
is_default_rom,
}
if (pdev->romsize != -1) {
if (size > pdev->romsize) {
- error_setg(errp, "romfile \"%s\" (%u bytes) is too large for ROM
size %u",
+ error_setg(errp, "romfile \"%s\" (%u bytes) "
+ "is too large for ROM size %u",
pdev->romfile, (uint32_t)size, pdev->romsize);
g_free(path);
return;
@@ -2374,14 +2374,13 @@ static void pci_add_option_rom(PCIDevice *pdev, bool
is_default_rom,
}
vmsd = qdev_get_vmsd(DEVICE(pdev));
+ snprintf(name, sizeof(name), "%s.rom",
+ vmsd ? vmsd->name : object_get_typename(OBJECT(pdev)));
- if (vmsd) {
- snprintf(name, sizeof(name), "%s.rom", vmsd->name);
- } else {
- snprintf(name, sizeof(name), "%s.rom",
object_get_typename(OBJECT(pdev)));
- }
pdev->has_rom = true;
- memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, pdev->romsize,
&error_fatal);
+ memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, pdev->romsize,
+ &error_fatal);
+
ptr = memory_region_get_ram_ptr(&pdev->rom);
if (load_image_size(path, ptr, size) < 0) {
error_setg(errp, "failed to load romfile \"%s\"", pdev->romfile);
--
MST
- [PULL 05/40] docs/cxl: Remove incorrect CXL type 3 size parameter, (continued)
- [PULL 05/40] docs/cxl: Remove incorrect CXL type 3 size parameter, Michael S. Tsirkin, 2023/05/19
- [PULL 07/40] hw/cxl: drop pointless memory_region_transaction_guards, Michael S. Tsirkin, 2023/05/19
- [PULL 08/40] hw/cxl: Fix endian handling for decoder commit., Michael S. Tsirkin, 2023/05/19
- [PULL 09/40] hw/cxl: Fix incorrect reset of commit and associated clearing of committed., Michael S. Tsirkin, 2023/05/19
- [PULL 11/40] hw/mem: Use memory_region_size() in cxl_type3, Michael S. Tsirkin, 2023/05/19
- [PULL 10/40] tests/qtest/cxl-test: whitespace, line ending cleanup, Michael S. Tsirkin, 2023/05/19
- [PULL 13/40] ACPI: bios-tables-test.c step 2 (allowed-diff entries), Michael S. Tsirkin, 2023/05/19
- [PULL 14/40] ACPI: i386: bump to MADT to revision 3, Michael S. Tsirkin, 2023/05/19
- [PULL 12/40] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent), Michael S. Tsirkin, 2023/05/19
- [PULL 17/40] pci: pci_add_option_rom(): refactor: use g_autofree for path variable, Michael S. Tsirkin, 2023/05/19
- [PULL 16/40] pci: pci_add_option_rom(): improve style,
Michael S. Tsirkin <=
- [PULL 18/40] vhost-user: send SET_STATUS 0 after GET_VRING_BASE, Michael S. Tsirkin, 2023/05/19
- [PULL 19/40] hw/pci: Disable PCI_ERR_UNCOR_MASK register for machine type < 8.0, Michael S. Tsirkin, 2023/05/19
- [PULL 20/40] virtio-mem: Default to "unplugged-inaccessible=on" with 8.1 on x86-64, Michael S. Tsirkin, 2023/05/19
- [PULL 21/40] vhost-user: Remove acpi-specific memslot limit, Michael S. Tsirkin, 2023/05/19
- [PULL 22/40] virtio-net: not enable vq reset feature unconditionally, Michael S. Tsirkin, 2023/05/19
- [PULL 23/40] virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_request, Michael S. Tsirkin, 2023/05/19
- [PULL 26/40] vhost-vdpa: Add check for full 64-bit in region delete, Michael S. Tsirkin, 2023/05/19
- [PULL 24/40] vhost: expose function vhost_dev_has_iommu(), Michael S. Tsirkin, 2023/05/19
- [PULL 15/40] ACPI: bios-tables-test.c step 5 (update expected table binaries), Michael S. Tsirkin, 2023/05/19
- [PULL 29/40] hw/pci-host/q35: Inline sysbus_add_io(), Michael S. Tsirkin, 2023/05/19