[Qemu-devel] [PATCH 2/4] nvdimm: use *function* directly instead of allocating it again

Wei Yang posted 4 patches 6 years, 8 months ago
Maintainers: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Richard Henderson <rth@twiddle.net>, Xiao Guangrong <xiaoguangrong.eric@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
[Qemu-devel] [PATCH 2/4] nvdimm: use *function* directly instead of allocating it again
Posted by Wei Yang 6 years, 8 months ago
At the beginning or nvdimm_build_common_dsm(), variable *function* is
already allocated for Arg2.

This patch reuse variable *function* instead of allocating it again.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 hw/acpi/nvdimm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 39af8cdba8..e63a1ef15d 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -1086,7 +1086,7 @@ static void nvdimm_build_common_dsm(Aml *dev)
      */
     aml_append(method, aml_store(handle, aml_name(NVDIMM_DSM_HANDLE)));
     aml_append(method, aml_store(aml_arg(1), aml_name(NVDIMM_DSM_REVISION)));
-    aml_append(method, aml_store(aml_arg(2), aml_name(NVDIMM_DSM_FUNCTION)));
+    aml_append(method, aml_store(function, aml_name(NVDIMM_DSM_FUNCTION)));
 
     /*
      * The fourth parameter (Arg3) of _DSM is a package which contains
-- 
2.19.1


Re: [Qemu-devel] [PATCH 2/4] nvdimm: use *function* directly instead of allocating it again
Posted by Igor Mammedov 6 years, 8 months ago
On Wed, 27 Feb 2019 15:50:59 +0800
Wei Yang <richardw.yang@linux.intel.com> wrote:

> At the beginning or nvdimm_build_common_dsm(), variable *function* is
> already allocated for Arg2.
> 
> This patch reuse variable *function* instead of allocating it again.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  hw/acpi/nvdimm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
> index 39af8cdba8..e63a1ef15d 100644
> --- a/hw/acpi/nvdimm.c
> +++ b/hw/acpi/nvdimm.c
> @@ -1086,7 +1086,7 @@ static void nvdimm_build_common_dsm(Aml *dev)
>       */
>      aml_append(method, aml_store(handle, aml_name(NVDIMM_DSM_HANDLE)));
>      aml_append(method, aml_store(aml_arg(1), aml_name(NVDIMM_DSM_REVISION)));
> -    aml_append(method, aml_store(aml_arg(2), aml_name(NVDIMM_DSM_FUNCTION)));
> +    aml_append(method, aml_store(function, aml_name(NVDIMM_DSM_FUNCTION)));
>  
>      /*
>       * The fourth parameter (Arg3) of _DSM is a package which contains