[PATCH v2 4/4] target/arm: Remove timer_del()/timer_deinit() before timer_free()

Peter Maydell posted 4 patches 4 years, 11 months ago
Maintainers: Alberto Garcia <berto@igalia.com>, Max Reitz <mreitz@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Keith Busch <kbusch@kernel.org>, Matthew Rosato <mjrosato@linux.ibm.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Klaus Jensen <its@irrelevant.dk>, Ronnie Sahlberg <ronniesahlberg@gmail.com>, Thomas Huth <thuth@redhat.com>, Amit Shah <amit@kernel.org>, John Snow <jsnow@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Jason Wang <jasowang@redhat.com>, Zhang Chen <chen.zhang@intel.com>, Alex Williamson <alex.williamson@redhat.com>, Eric Blake <eblake@redhat.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, "Michael S. Tsirkin" <mst@redhat.com>, David Hildenbrand <david@redhat.com>, Laurent Vivier <lvivier@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Juan Quintela <quintela@redhat.com>, Li Zhijian <lizhijian@cn.fujitsu.com>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Hailiang Zhang <zhang.zhanghailiang@huawei.com>, Corey Minyard <minyard@acm.org>, Greg Kurz <groug@kaod.org>, Peter Lieven <pl@kamp.de>, Gerd Hoffmann <kraxel@redhat.com>
[PATCH v2 4/4] target/arm: Remove timer_del()/timer_deinit() before timer_free()
Posted by Peter Maydell 4 years, 11 months ago
The Arm CPU finalize function uses a sequence of timer_del(), timer_deinit(),
timer_free() to free the timer. The timer_deinit() step in this was always
unnecessary, and now the timer_del() is implied by timer_free(), so we can
collapse this down to simply calling timer_free().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/cpu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index d6188f6566a..b4795a2bf44 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1304,8 +1304,6 @@ static void arm_cpu_finalizefn(Object *obj)
     }
 #ifndef CONFIG_USER_ONLY
     if (cpu->pmu_timer) {
-        timer_del(cpu->pmu_timer);
-        timer_deinit(cpu->pmu_timer);
         timer_free(cpu->pmu_timer);
     }
 #endif
-- 
2.20.1


Re: [PATCH v2 4/4] target/arm: Remove timer_del()/timer_deinit() before timer_free()
Posted by Richard Henderson 4 years, 11 months ago
On 12/15/20 9:41 AM, Peter Maydell wrote:
> The Arm CPU finalize function uses a sequence of timer_del(), timer_deinit(),
> timer_free() to free the timer. The timer_deinit() step in this was always
> unnecessary, and now the timer_del() is implied by timer_free(), so we can
> collapse this down to simply calling timer_free().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target/arm/cpu.c | 2 --
>  1 file changed, 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~