[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] pci: pci_add_option_rom(): improve style
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH 1/3] pci: pci_add_option_rom(): improve style |
Date: |
Tue, 25 Apr 2023 13:56:01 +0300 |
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>
---
hw/pci/pci.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index def5000e7b..4a61c8d24a 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2297,10 +2297,12 @@ static void pci_add_option_rom(PCIDevice *pdev, bool
is_default_rom,
char name[32];
const VMStateDescription *vmsd;
- if (!pdev->romfile)
+ if (!pdev->romfile) {
return;
- if (strlen(pdev->romfile) == 0)
+ }
+ if (strlen(pdev->romfile) == 0) {
return;
+ }
if (!pdev->rom_bar) {
/*
@@ -2349,7 +2351,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;
@@ -2359,14 +2362,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);
--
2.34.1
- [PATCH 0/3] ROM migration, Vladimir Sementsov-Ogievskiy, 2023/04/25
- [PATCH 3/3] pci: ROM preallocation for incoming migration, Vladimir Sementsov-Ogievskiy, 2023/04/25
- Re: [PATCH 3/3] pci: ROM preallocation for incoming migration, Michael S. Tsirkin, 2023/04/25
- Re: [PATCH 3/3] pci: ROM preallocation for incoming migration, Vladimir Sementsov-Ogievskiy, 2023/04/25
- Re: [PATCH 3/3] pci: ROM preallocation for incoming migration, Vladimir Sementsov-Ogievskiy, 2023/04/25
- Re: [PATCH 3/3] pci: ROM preallocation for incoming migration, Michael S. Tsirkin, 2023/04/25
- Re: [PATCH 3/3] pci: ROM preallocation for incoming migration, Igor Mammedov, 2023/04/25
- Re: [PATCH 3/3] pci: ROM preallocation for incoming migration, Vladimir Sementsov-Ogievskiy, 2023/04/25
[PATCH 2/3] pci: pci_add_option_rom(): refactor: use g_autofree for path variable, Vladimir Sementsov-Ogievskiy, 2023/04/25
[PATCH 1/3] pci: pci_add_option_rom(): improve style,
Vladimir Sementsov-Ogievskiy <=