All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] fw_cfg: Trivial cleanups
@ 2019-03-09 18:19 Philippe Mathieu-Daudé
  2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 1/2] hw/arm/virt: Remove null-check in virt_build_smbios() Philippe Mathieu-Daudé
  2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 2/2] hw/nvram/fw_cfg: Use the ldst API Philippe Mathieu-Daudé
  0 siblings, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-03-09 18:19 UTC (permalink / raw)
  To: qemu-trivial, qemu-devel
  Cc: Laurent Vivier, Laszlo Ersek, Peter Maydell, Michael Tokarev,
	Gerd Hoffmann, Philippe Mathieu-Daudé,
	qemu-arm

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(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH v3 1/2] hw/arm/virt: Remove null-check in virt_build_smbios()
  2019-03-09 18:19 [Qemu-devel] [PATCH v3 0/2] fw_cfg: Trivial cleanups Philippe Mathieu-Daudé
@ 2019-03-09 18:19 ` Philippe Mathieu-Daudé
  2019-03-10 10:55   ` Laurent Vivier
  2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 2/2] hw/nvram/fw_cfg: Use the ldst API Philippe Mathieu-Daudé
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-03-09 18:19 UTC (permalink / raw)
  To: qemu-trivial, qemu-devel
  Cc: Laurent Vivier, Laszlo Ersek, Peter Maydell, Michael Tokarev,
	Gerd Hoffmann, Philippe Mathieu-Daudé,
	qemu-arm, Markus Armbruster

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.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v2: Corrected commit reference (Laszlo)
v3: Dropped 'Fixes:' (Markus)
---
 hw/arm/virt.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 7f66ddad89..377e95a4cd 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -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";
     }
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH v3 2/2] hw/nvram/fw_cfg: Use the ldst API
  2019-03-09 18:19 [Qemu-devel] [PATCH v3 0/2] fw_cfg: Trivial cleanups Philippe Mathieu-Daudé
  2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 1/2] hw/arm/virt: Remove null-check in virt_build_smbios() Philippe Mathieu-Daudé
@ 2019-03-09 18:19 ` Philippe Mathieu-Daudé
  2019-03-10 10:56   ` Laurent Vivier
  1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-03-09 18:19 UTC (permalink / raw)
  To: qemu-trivial, qemu-devel
  Cc: Laurent Vivier, Laszlo Ersek, Peter Maydell, Michael Tokarev,
	Gerd Hoffmann, Philippe Mathieu-Daudé,
	qemu-arm

The load/store API eases code review.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/nvram/fw_cfg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 7fdf04adc9..3d8859e333 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -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;
         }
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] hw/arm/virt: Remove null-check in virt_build_smbios()
  2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 1/2] hw/arm/virt: Remove null-check in virt_build_smbios() Philippe Mathieu-Daudé
@ 2019-03-10 10:55   ` Laurent Vivier
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2019-03-10 10:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-trivial, qemu-devel
  Cc: Laszlo Ersek, Peter Maydell, Michael Tokarev, Gerd Hoffmann,
	qemu-arm, Markus Armbruster

On 09/03/2019 19:19, Philippe Mathieu-Daudé wrote:
> 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.
> 
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v2: Corrected commit reference (Laszlo)
> v3: Dropped 'Fixes:' (Markus)
> ---
>  hw/arm/virt.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 7f66ddad89..377e95a4cd 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v3 2/2] hw/nvram/fw_cfg: Use the ldst API
  2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 2/2] hw/nvram/fw_cfg: Use the ldst API Philippe Mathieu-Daudé
@ 2019-03-10 10:56   ` Laurent Vivier
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2019-03-10 10:56 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-trivial, qemu-devel
  Cc: Laszlo Ersek, Peter Maydell, Michael Tokarev, Gerd Hoffmann, qemu-arm

On 09/03/2019 19:19, Philippe Mathieu-Daudé wrote:
> The load/store API eases code review.
> 
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/nvram/fw_cfg.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 7fdf04adc9..3d8859e333 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -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;
>          }
> 

Applied to my trivial-patches branch.

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-10 10:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 18:19 [Qemu-devel] [PATCH v3 0/2] fw_cfg: Trivial cleanups Philippe Mathieu-Daudé
2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 1/2] hw/arm/virt: Remove null-check in virt_build_smbios() Philippe Mathieu-Daudé
2019-03-10 10:55   ` Laurent Vivier
2019-03-09 18:19 ` [Qemu-devel] [PATCH v3 2/2] hw/nvram/fw_cfg: Use the ldst API Philippe Mathieu-Daudé
2019-03-10 10:56   ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.