diff mbox series

system/physmem: remove redundant arg reassignment

Message ID 20240215091506.1932251-1-manos.pitsidianakis@linaro.org (mailing list archive)
State New, archived
Headers show
Series system/physmem: remove redundant arg reassignment | expand

Commit Message

Manos Pitsidianakis Feb. 15, 2024, 9:15 a.m. UTC
Arguments `ram_block` are reassigned to local declarations `block`
without further use. Remove re-assignment to reduce noise.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
---
 system/physmem.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)


base-commit: 5767815218efd3cbfd409505ed824d5f356044ae

Comments

David Hildenbrand Feb. 15, 2024, 9:37 a.m. UTC | #1
On 15.02.24 10:15, Manos Pitsidianakis wrote:
> Arguments `ram_block` are reassigned to local declarations `block`
> without further use. Remove re-assignment to reduce noise.
> 
> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> ---
>   system/physmem.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/system/physmem.c b/system/physmem.c
> index 5e66d9ae36..d4c3bfac65 100644
> --- a/system/physmem.c
> +++ b/system/physmem.c
> @@ -2154,10 +2154,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
>    *
>    * Called within RCU critical section.
>    */
> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)
>   {
> -    RAMBlock *block = ram_block;
> -
>       if (block == NULL) {
>           block = qemu_get_ram_block(addr);
>           addr -= block->offset;
> @@ -2182,10 +2180,9 @@ void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
>    *
>    * Called within RCU critical section.
>    */
> -static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr,
> +static void *qemu_ram_ptr_length(RAMBlock *block, ram_addr_t addr,
>                                    hwaddr *size, bool lock)
>   {
> -    RAMBlock *block = ram_block;
>       if (*size == 0) {
>           return NULL;
>       }
> 
> base-commit: 5767815218efd3cbfd409505ed824d5f356044ae

Reviewed-by: David Hildenbrand <david@redhat.com>
Michael Tokarev Feb. 15, 2024, 9:38 a.m. UTC | #2
15.02.2024 12:15, Manos Pitsidianakis :
> Arguments `ram_block` are reassigned to local declarations `block`
> without further use. Remove re-assignment to reduce noise.

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
And applied to trivial-patches, thanks!

/mjt
Philippe Mathieu-Daudé Feb. 15, 2024, 11:09 a.m. UTC | #3
On 15/2/24 10:15, Manos Pitsidianakis wrote:
> Arguments `ram_block` are reassigned to local declarations `block`
> without further use. Remove re-assignment to reduce noise.
> 
> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> ---
>   system/physmem.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/system/physmem.c b/system/physmem.c
> index 5e66d9ae36..d4c3bfac65 100644
> --- a/system/physmem.c
> +++ b/system/physmem.c
> @@ -2154,10 +2154,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
>    *
>    * Called within RCU critical section.
>    */
> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)

Better update the declaration in the same commit:

-- >8 --
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 177be23db7..bf4db3b374 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2960,7 +2960,7 @@ MemTxResult flatview_read_continue(FlatView *fv, 
hwaddr addr,
                                     MemTxAttrs attrs, void *buf,
                                     hwaddr len, hwaddr addr1, hwaddr l,
                                     MemoryRegion *mr);
-void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr);
+void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr);

  /* Internal functions, part of the implementation of 
address_space_read_cached
   * and address_space_write_cached.  */
---

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Philippe Mathieu-Daudé Feb. 26, 2024, 8:54 a.m. UTC | #4
On 15/2/24 12:09, Philippe Mathieu-Daudé wrote:
> On 15/2/24 10:15, Manos Pitsidianakis wrote:
>> Arguments `ram_block` are reassigned to local declarations `block`
>> without further use. Remove re-assignment to reduce noise.
>>
>> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
>> ---
>>   system/physmem.c | 7 ++-----
>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/system/physmem.c b/system/physmem.c
>> index 5e66d9ae36..d4c3bfac65 100644
>> --- a/system/physmem.c
>> +++ b/system/physmem.c
>> @@ -2154,10 +2154,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t 
>> length)
>>    *
>>    * Called within RCU critical section.
>>    */
>> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
>> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)
> 
> Better update the declaration in the same commit:
> 
> -- >8 --
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 177be23db7..bf4db3b374 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -2960,7 +2960,7 @@ MemTxResult flatview_read_continue(FlatView *fv, 
> hwaddr addr,
>                                      MemTxAttrs attrs, void *buf,
>                                      hwaddr len, hwaddr addr1, hwaddr l,
>                                      MemoryRegion *mr);
> -void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr);
> +void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr);

FYI this is now merged as commit aab4631a4a ("system/physmem:
remove redundant arg reassignment").

> 
>   /* Internal functions, part of the implementation of 
> address_space_read_cached
>    * and address_space_write_cached.  */
> ---
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
diff mbox series

Patch

diff --git a/system/physmem.c b/system/physmem.c
index 5e66d9ae36..d4c3bfac65 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -2154,10 +2154,8 @@  void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
  *
  * Called within RCU critical section.
  */
-void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
+void *qemu_map_ram_ptr(RAMBlock *block, ram_addr_t addr)
 {
-    RAMBlock *block = ram_block;
-
     if (block == NULL) {
         block = qemu_get_ram_block(addr);
         addr -= block->offset;
@@ -2182,10 +2180,9 @@  void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr)
  *
  * Called within RCU critical section.
  */
-static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr,
+static void *qemu_ram_ptr_length(RAMBlock *block, ram_addr_t addr,
                                  hwaddr *size, bool lock)
 {
-    RAMBlock *block = ram_block;
     if (*size == 0) {
         return NULL;
     }