fw_cfg: Trivial cleanups
v3 cover fw_cfg: Trivial cleanups
Hi Laurent,
These 2 patches are trivial cleanups extracted from a bigger fw_cfg series.
Please consider for your next Trivial pull request.
Regards,
Phil.
v2: https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg02522.html
v1: https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg01598.html
Philippe Mathieu-Daudé (2):
hw/arm/virt: Remove null-check in virt_build_smbios() hw/nvram/fw_cfg: Use the ldst API
hw/arm/virt.c | 4 ---- hw/nvram/fw_cfg.c | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/2 hw/arm/virt: Remove null-check in virt_build_smbios()
Since commit 578f3c7b0835 ("arm: add fw_cfg to "virt" board", 2014-12-22), the machvirt_init() unconditionally creates the fw_cfg object. Later, commit c30e15658b1b ("smbios: implement smbios support for mach-virt", 2015-09-07) added a superfluous null-check on it.
Remove this superfluous check.
---
v2: Corrected commit reference (Laszlo)
v3: Dropped 'Fixes:' (Markus)
--- hw/arm/virt.c | 4 ---- 1 file changed, 4 deletions(-)
hw/arm/virt.c +0 -4
@@ -1281,10 +1281,6 @@ static void virt_build_smbios(VirtMachineState *vms)size_t smbios_tables_len, smbios_anchor_len;const char *product ="QEMU Virtual Machine" ; -if (!vms->fw_cfg) { -return ; - } -if (kvm_enabled ()) { product ="KVM Virtual Machine" ; }
Signature · 1 line
2.20.1
Laurent Vivier
AppliedRe: [Qemu-arm] [PATCH v3 1/2] hw/arm/virt: Remove null-check in virt_build_smbios()
Quoted 23 lines · Philippe Mathieu-Daudé
Since commit
578f3c7b0835("arm: addfw_cfgto "virt" board", 2014-12-22), themachvirt_init()unconditionally creates thefw_cfgobject. Later, commitc30e15658b1b("smbios: implement smbios support for mach-virt", 2015-09-07) added a superfluous null-check on it.
Remove this superfluous check.Reviewed-by Laszlo Ersek <[email protected]>Reviewed-by Markus Armbruster <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
v2: Corrected commit reference (Laszlo)
v3: Dropped 'Fixes:' (Markus)--- hw/arm/virt.c | 4 ---- 1 file changed, 4 deletions(-)hw/arm/virt.c +0
-0
hw/arm/virt.c static void virt_build_smbios(VirtMachineState *vms) · line 1286
Quoted 10 lines
hw/arm/virt.c +0
-4@@ -1281,10 +1281,6 @@ static void virt_build_smbios(VirtMachineState *vms)size_t smbios_tables_len, smbios_anchor_len;const char *product ="QEMU Virtual Machine" ; -if (!vms->fw_cfg) { -return ; - } -if (kvm_enabled ()) { product ="KVM Virtual Machine" ; }
Applied to my trivial-patches branch.
Thanks,
Laurent
PATCH v3 2/2 hw/nvram/fw_cfg: Use the ldst API
In reply to Philippe Mathieu-DaudéThe load/store API eases code review.
--- hw/nvram/fw_cfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/nvram/fw_cfg.c +2 -2
@@ -85,7 +85,7 @@ static char *read_splashfile(char *filename, gsize *file_sizep, }/* check magic ID */ - filehead = ((content[0 ] &0xff ) + (content[1 ] <<8 )) &0xffff ; + filehead =lduw_le_p (content);if (filehead ==0xd8ff ) { file_type =JPG_FILE ; }else if (filehead ==0x4d42 ) {
@@ -96,7 +96,7 @@ static char *read_splashfile(char *filename, gsize *file_sizep,/* check BMP bpp */ if (file_type ==BMP_FILE ) { - bmp_bpp = (content[28 ] + (content[29 ] <<8 )) &0xffff ; + bmp_bpp =lduw_le_p (&content[28 ]);if (bmp_bpp !=24 ) { goto error; }
Signature · 1 line
2.20.1
Laurent Vivier
AppliedRe: [Qemu-arm] [PATCH v3 2/2] hw/nvram/fw_cfg: Use the ldst API
Quoted 23 lines · Philippe Mathieu-Daudé
The load/store API eases code review.
Reviewed-by Laszlo Ersek <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/nvram/fw_cfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/nvram/fw_cfg.c +1
-1@@ -85,7 +85,7 @@ static char *read_splashfile(char *filename, gsize *file_sizep, }/* check magic ID */ - filehead = ((content[0 ] &0xff ) + (content[1 ] <<8 )) &0xffff ; + filehead =lduw_le_p (content);if (filehead ==0xd8ff ) { file_type =JPG_FILE ; }else if (filehead ==0x4d42 ) {
hw/nvram/fw_cfg.c static char *read_splashfile(char *filename, gsize *file_sizep, · line 102
Quoted 8 lines
hw/nvram/fw_cfg.c +1
-1@@ -96,7 +96,7 @@ static char *read_splashfile(char *filename, gsize *file_sizep,/* check BMP bpp */ if (file_type ==BMP_FILE ) { - bmp_bpp = (content[28 ] + (content[29 ] <<8 )) &0xffff ; + bmp_bpp =lduw_le_p (&content[28 ]);if (bmp_bpp !=24 ) { goto error; }
Applied to my trivial-patches branch.
Thanks,
Laurent