From nobody Tue Nov 18 02:49:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608071768; cv=none; d=zohomail.com; s=zohoarc; b=lF9Y/DYuHH9iS+80LFHz/EW5dcX8oWPxSaNIWvM4SVtxJiBddRUuIlBDMvhJQkFWD/WY7e5Kwkp5UK+ZArzzsfYNyDkh0tV24mo2I33sLK+k68UVc9yPUMEmMSAppEKQbOUeu3Kdp1cORVuOK56FXdLUUkrvvhoPySgJNzVM/YQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608071768; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NkI1JPV6T76myH92t9WLjDACCV+iWxQLh0fjZqVGsx0=; b=YUV/P2iiORSQxRIBcYj49bNLKQruuG7diJKwKxsY+upYLZL4arTphZgkq55D7ZHgvFLW1g2SYi8jNUZ0OL4ZMlYlE68IKFRCfsyr9l2KsJP0sdA1jLoPdYGPxDucTl6w8QMi7ubhBkamoDu+bp1gzyubSKv3mHRGpQhLogCcw5s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608071768259632.5518387050886; Tue, 15 Dec 2020 14:36:08 -0800 (PST) Received: from localhost ([::1]:58822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpCYC-00022h-QQ for importer@patchew.org; Tue, 15 Dec 2020 10:47:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpCRu-0003NO-J2 for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:14 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:37075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpCRs-0004ty-WC for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:14 -0500 Received: by mail-wr1-x444.google.com with SMTP id i9so20317311wrc.4 for ; Tue, 15 Dec 2020 07:41:12 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 34sm38259978wrh.78.2020.12.15.07.41.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 07:41:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NkI1JPV6T76myH92t9WLjDACCV+iWxQLh0fjZqVGsx0=; b=FDfzgfAElQm3Ralfyk4cDrZz/22Jb2tASbI+eMOhIyqSICyROMcrWbSlJxxxsL9Jrv w0/svmaL9jMAfRz0Hytk1GeEoGBrQESZPpSjy440GC5m/5B2IU/N39je5HFhK3b0wYyK x42hCns2HHXXsoOJhCPhLchAuId6wGdexc6LFkYl7vcld+Tkqui14RJbNx0Asz2Mu7YK q7xCSYd7E+0mvPwoHAHX63WCl7lLLjsAe8L3VesgiFTtRJH8/eYzYoCTvEasaCojsYwn 3JZgEy3MKobf+4b2oVsHYJnvkq1Ttn7SY6OU3fZkmEac4ERs3Sh6NRhFUdx6FfExSidt 9vrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NkI1JPV6T76myH92t9WLjDACCV+iWxQLh0fjZqVGsx0=; b=K6gJ3DbXIb6XHnQDJO41EGogWWu9yuHavgeGmT3uObcVQznBD+xGkGmc3OzqqeuQk8 loR+zeedZpW+8EtSy7SEWZtj9SOi9Pmn2gMn+PNztcOUBPNkgcbIL3vbsaSBaV4FDcsz jIF/ZujZPSyaEYdzp7AUwvs8PvLDV1HBGlXOiIyihPtfq98v44kIWo+vk3z4PUu3hoG3 a6qSwbwnEMuFr20SLm+Z4l+d6yXjfuxweV9OpjkiSVjv4GMDDfJ1nEOkgVZFEJ3UqZfQ wvdwoqnIpax5JarcCX4V7dvLFJfdl6qouuhEwFBWt1CfJKy+AwqveY0x34zJZ0d8GckL I8Ug== X-Gm-Message-State: AOAM531hQkFsRVbVVwbL6jfGg2U4/EwyHb6RHOcn48PUslSz9WVWgYkq yrYo7UU1cUoTZB36F+VQVg/oALRLrbJXPw== X-Google-Smtp-Source: ABdhPJydtmdP4JKUA5Qr5bKFXcvYiBVrZK0ttV9wKD929tCySRTjITsdtmlARFe0DIk2xVygfzDxQQ== X-Received: by 2002:adf:80ae:: with SMTP id 43mr3386140wrl.50.1608046871362; Tue, 15 Dec 2020 07:41:11 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 1/4] util/qemu-timer: Make timer_free() imply timer_del() Date: Tue, 15 Dec 2020 15:41:04 +0000 Message-Id: <20201215154107.3255-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201215154107.3255-1-peter.maydell@linaro.org> References: <20201215154107.3255-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x444.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Currently timer_free() is a simple wrapper for g_free(). This means that the timer being freed must not be currently active, as otherwise QEMU might crash later when the active list is processed and still has a pointer to freed memory on it. As a result almost all calls to timer_free() are preceded by a timer_del() call, as can be seen in the output of git grep -B1 '\' This is unfortunate API design as it makes it easy to accidentally misuse (by forgetting the timer_del()), and the correct use is annoyingly verbose. Make timer_free() imply a timer_del(). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/qemu/timer.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index bdecc5b41fe..ed84ad8f3aa 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -609,17 +609,6 @@ static inline QEMUTimer *timer_new_ms(QEMUClockType ty= pe, QEMUTimerCB *cb, */ void timer_deinit(QEMUTimer *ts); =20 -/** - * timer_free: - * @ts: the timer - * - * Free a timer (it must not be on the active list) - */ -static inline void timer_free(QEMUTimer *ts) -{ - g_free(ts); -} - /** * timer_del: * @ts: the timer @@ -631,6 +620,20 @@ static inline void timer_free(QEMUTimer *ts) */ void timer_del(QEMUTimer *ts); =20 +/** + * timer_free: + * @ts: the timer + * + * Free a timer. This will call timer_del() for you to remove + * the timer from the active list if it was still active. + */ +static inline void timer_free(QEMUTimer *ts) +{ + + timer_del(ts); + g_free(ts); +} + /** * timer_mod_ns: * @ts: the timer --=20 2.20.1 From nobody Tue Nov 18 02:49:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608067689; cv=none; d=zohomail.com; s=zohoarc; b=WDrr47HkXf0jmSeRbNDX7Y/mMFzb4QxWTzGCgLFG8ULVgZRMYm6ocFVWnuAoJ/2VWyACAo9U2hC9UD8ZyoNUyTZO3KMhtjQjCJongc4ZlMu5bcUNIOg6lfXxNXVCaGbRWhmHI7/En1/PJGCAGpsrQ7Da4VNcMZl0DqU9hjcT23U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608067689; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c7bNvnyceo3xPeeAF05QCJAT5Wp/7viHuY0BxuSz7YY=; b=KdlAufZ8R5RkeNQYf8TF46fOJT5lI6heYYURTodj2e1OctqvjIbVB0mdRGW6UHPyx0uy2f7I6qtgaUNcr3UASN6sJhTw38eAD3kDJR8yTCEhnrL6H1k7b31bwECh/X2Keq8VEc545cPJ9438crlv5fNhCNMqL1ypjtZB2OwJtxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160806768991823.39656641804254; Tue, 15 Dec 2020 13:28:09 -0800 (PST) Received: from localhost ([::1]:35004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpCZh-0003tQ-Ub for importer@patchew.org; Tue, 15 Dec 2020 10:49:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpCRv-0003QK-RQ for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:15 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpCRu-0004u6-4B for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:15 -0500 Received: by mail-wr1-x442.google.com with SMTP id r3so20333820wrt.2 for ; Tue, 15 Dec 2020 07:41:13 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 34sm38259978wrh.78.2020.12.15.07.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 07:41:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c7bNvnyceo3xPeeAF05QCJAT5Wp/7viHuY0BxuSz7YY=; b=GsOZbuTXB1qrpE+nmi18kBVQ8inhJBEAa62A/ZPgLSDvzDiLcldjr9nlaAptOnaTcS s0SXHXIKARUCKZ8IcUMPBAbGPPtzpKKidK9UpcP734u3TT5GwhYd0DpK4ANCy356d5IF BDnvigtcasWhwRRdHFLHoi1lLadhhSAuGuWZHGR0q4/7W76EXpC2OGBsetxl3462sGjZ pMfD5d/1Bnv7lminVv1Zf3VPIGswIBvb1zxKSuoAqSIUHTFTXzDwiSrFkZHEdAr6EfiE 5rR+kkiJkTpTXcJcfExIKmB3yS6cyPRaVN8KXnGH8kvFTZaRnmnY/vM5kZgsAcqLYrDx LXSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c7bNvnyceo3xPeeAF05QCJAT5Wp/7viHuY0BxuSz7YY=; b=h9zO+FfNim4RUb23+4+9DrpZ+CNbxfEWsNXPqM6uJhzvOIYBZoGLTHS1nQtqmHF8Fn VLnabWYfVABKA5xsLsfx2dewykt6CRlFKS4cVZTMJ7vPVHlMyUH1LImyimSvtSBFJimZ Sy1umepwUz6awBp1gbdUXm7rhR8lCDRhxIJLtzySqY+gMRYVlTu4n9Mb+YdV5PZPxXZY ehZSzBtFbWJY1q55o4o4u1N85///oAaOR4dJUV6f9DmgA/62mgWvHM3vM7VBRraaiEuW RSq4MQC97OAX55XT/ZTxcG0JzrQYzyTPViqbA3aCYQFn2EL58RxKOqOM+6JXtOMlPjUp fs5w== X-Gm-Message-State: AOAM531//TlqZ+CP/OH/2chtWQNtCm6FjBSnBnDveRkLpkNLFWMGrMtm adw3QamZS6+GgEhPGo5Oz/781jqPF5zxdQ== X-Google-Smtp-Source: ABdhPJzyN88F+tAwjLFOcCstFIwcODWq9AUcuSLCl9vYMKha7cQPKiUXKNXXrhl+TixpZUHKZX7dog== X-Received: by 2002:adf:f58a:: with SMTP id f10mr22427204wro.338.1608046872544; Tue, 15 Dec 2020 07:41:12 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 2/4] scripts/coccinelle: New script to remove unnecessary timer_del() calls Date: Tue, 15 Dec 2020 15:41:05 +0000 Message-Id: <20201215154107.3255-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201215154107.3255-1-peter.maydell@linaro.org> References: <20201215154107.3255-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x442.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Now that timer_free() implicitly calls timer_del(), sequences timer_del(mytimer); timer_free(mytimer); can be simplified to just timer_free(mytimer); Add a Coccinelle script to do this transformation. Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccin= elle/timer-del-timer-free.cocci new file mode 100644 index 00000000000..c3cfd428039 --- /dev/null +++ b/scripts/coccinelle/timer-del-timer-free.cocci @@ -0,0 +1,18 @@ +// Remove superfluous timer_del() calls +// +// Copyright Linaro Limited 2020 +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch --macro-file scripts/cocci-macro-file.h \ +// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \ +// --in-place --dir . +// +// The timer_free() function now implicitly calls timer_del() +// for you, so calls to timer_del() immediately before the +// timer_free() of the same timer can be deleted. + +@@ +expression T; +@@ +-timer_del(T); + timer_free(T); --=20 2.20.1 From nobody Tue Nov 18 02:49:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608065418; cv=none; d=zohomail.com; s=zohoarc; b=KnkxPklf+j2t3xqDnDM9YoZG1m9QJobW2mWHm7Pu8N81gRl8DY7AGW4YuFzcnWkOymXKZZ3zVL06dbcj9v3FS/99IvRNuqBVIRI5ePngFnwvAgz94bbwgF6cQ6IKYLOJvyUvE/RvFBgS9guClBW5jnb5EduBNp6C0pBW17pt7Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608065418; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=K0odxzds15ilmtSFzrIahh9saevoDjTCBLe9Je8/x0Q=; b=U23FEMK1vn/leMUG4qi2yav1g3OrWDYX9xnmydQZ0A9duLYIQzp68DFbizUZWtXSv8NIgU0dlU2rpqsxMKmDGS8ngafivOForBo6lUdt6JoHiiQG/xmQUokEWKD5pIM/id02MLE9fQMV4XdGKB4jJMO2cw5IUY0qRkt+f7eizv0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608065418316656.4208527817075; Tue, 15 Dec 2020 12:50:18 -0800 (PST) Received: from localhost ([::1]:46844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpCTY-0005Me-Pg for importer@patchew.org; Tue, 15 Dec 2020 10:42:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpCRz-0003Ye-I5 for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:19 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45102) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpCRw-0004uO-Kv for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:19 -0500 Received: by mail-wr1-x42a.google.com with SMTP id d26so7082033wrb.12 for ; Tue, 15 Dec 2020 07:41:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 34sm38259978wrh.78.2020.12.15.07.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 07:41:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K0odxzds15ilmtSFzrIahh9saevoDjTCBLe9Je8/x0Q=; b=iapVvCeJ+D7JeW7CkREEPq+9VDH9ncWcy/TZI8QQLIjmr7KZmrVRJSeWtwC4pMesVr hv0RriB+fZKEiVZ8zTnEGj+W7oEuF4TAcF7YZtrCWdpLI/5VIZnAQfeMIbDAWTJiENWS fpqsVbuhmliftUcouDcK/y4QRMMDNd1FE8teK/3HuG2kfpq+6T9mVv/Ddcd5H1Hp6iQ/ tyGVV+nUZFNukqKjn61OvtgBL9zI67W/YvGwXkx5g+9+WRNwi9a8pzv+VkZ5DaidI22y shtehLxjjlag8rNdBKWGghAYNCyJL5k02I81PmBlvfrMle0fnDoTzM5z7PLb4h1J1+IN KCpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K0odxzds15ilmtSFzrIahh9saevoDjTCBLe9Je8/x0Q=; b=JgovrtX09vbwp2kYexwbQwW4ZdXl6seH+iwRpNw3BUa8tenytaNS+yN4LmpaJgBnm3 qNtdvNdFz+gxS8ck4xra9F0LXOsCN5CJot3IdCg7ronkxch5DFs4ggzxPcUYzicHgZDp GssE+zIJLvRs8dyjXIEmD4v5P7lMn9s7kPZ/AXPSVHQRhbQGf4/nY27oFcFUo2lXhHI9 5cmrJ/UCFwcIgicA1+uTzZTBA1Y42VxZnRHCJvzZaYVtfgKobe41/FjratLRwUgq9K08 j+3QO8seATzHIfj0FONvso5pqPyUSC1ywb61/WTUbxR18ghZovBC9qIkIgct0rx3Vt9E +ZFw== X-Gm-Message-State: AOAM532Fv7KPDhdfXDLmgUwE+c4AWIbDiDwH4XmNicDYLcsome6+qmiP kGq32oRKmSXDFQn8L4L4E/kDHX1jOnDRjA== X-Google-Smtp-Source: ABdhPJxonZoUgiyE88wpAI8dzOiQq7Arj4msjqcLJYGey+zablBFBht3QAvn9PSHq9GhC8BEtokewA== X-Received: by 2002:a5d:678d:: with SMTP id v13mr34650510wru.71.1608046873969; Tue, 15 Dec 2020 07:41:13 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 3/4] Remove superfluous timer_del() calls Date: Tue, 15 Dec 2020 15:41:06 +0000 Message-Id: <20201215154107.3255-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201215154107.3255-1-peter.maydell@linaro.org> References: <20201215154107.3255-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This commit is the result of running the timer-del-timer-free.cocci script on the whole source tree. Signed-off-by: Peter Maydell Acked-by: Corey Minyard Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- block/iscsi.c | 2 -- block/nbd.c | 1 - block/qcow2.c | 1 - hw/block/nvme.c | 2 -- hw/char/serial.c | 2 -- hw/char/virtio-serial-bus.c | 2 -- hw/ide/core.c | 1 - hw/input/hid.c | 1 - hw/intc/apic.c | 1 - hw/intc/ioapic.c | 1 - hw/ipmi/ipmi_bmc_extern.c | 1 - hw/net/e1000.c | 3 --- hw/net/e1000e_core.c | 8 -------- hw/net/pcnet-pci.c | 1 - hw/net/rtl8139.c | 1 - hw/net/spapr_llan.c | 1 - hw/net/virtio-net.c | 2 -- hw/s390x/s390-pci-inst.c | 1 - hw/sd/sd.c | 1 - hw/sd/sdhci.c | 2 -- hw/usb/dev-hub.c | 1 - hw/usb/hcd-ehci.c | 1 - hw/usb/hcd-ohci-pci.c | 1 - hw/usb/hcd-uhci.c | 1 - hw/usb/hcd-xhci.c | 1 - hw/usb/redirect.c | 1 - hw/vfio/display.c | 1 - hw/virtio/vhost-vsock-common.c | 1 - hw/virtio/virtio-balloon.c | 1 - hw/virtio/virtio-rng.c | 1 - hw/watchdog/wdt_diag288.c | 1 - hw/watchdog/wdt_i6300esb.c | 1 - migration/colo.c | 1 - monitor/hmp-cmds.c | 1 - net/announce.c | 1 - net/colo-compare.c | 1 - net/slirp.c | 1 - replay/replay-debugging.c | 1 - target/s390x/cpu.c | 2 -- ui/console.c | 1 - ui/spice-core.c | 1 - util/throttle.c | 1 - 42 files changed, 58 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 7d4b3b56d5c..4d2a416ce77 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1524,12 +1524,10 @@ static void iscsi_detach_aio_context(BlockDriverSta= te *bs) iscsilun->events =3D 0; =20 if (iscsilun->nop_timer) { - timer_del(iscsilun->nop_timer); timer_free(iscsilun->nop_timer); iscsilun->nop_timer =3D NULL; } if (iscsilun->event_timer) { - timer_del(iscsilun->event_timer); timer_free(iscsilun->event_timer); iscsilun->event_timer =3D NULL; } diff --git a/block/nbd.c b/block/nbd.c index 42536702b6f..242a258f3a5 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -194,7 +194,6 @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *= s) static void reconnect_delay_timer_del(BDRVNBDState *s) { if (s->reconnect_delay_timer) { - timer_del(s->reconnect_delay_timer); timer_free(s->reconnect_delay_timer); s->reconnect_delay_timer =3D NULL; } diff --git a/block/qcow2.c b/block/qcow2.c index 3a90ef27868..5d94f45be95 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -852,7 +852,6 @@ static void cache_clean_timer_del(BlockDriverState *bs) { BDRVQcow2State *s =3D bs->opaque; if (s->cache_clean_timer) { - timer_del(s->cache_clean_timer); timer_free(s->cache_clean_timer); s->cache_clean_timer =3D NULL; } diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 01b657b1c5e..27d2c72716e 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1052,7 +1052,6 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest = *req) static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n) { n->sq[sq->sqid] =3D NULL; - timer_del(sq->timer); timer_free(sq->timer); g_free(sq->io_req); if (sq->sqid) { @@ -1334,7 +1333,6 @@ static uint16_t nvme_get_log(NvmeCtrl *n, NvmeRequest= *req) static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n) { n->cq[cq->cqid] =3D NULL; - timer_del(cq->timer); timer_free(cq->timer); msix_vector_unuse(&n->parent_obj, cq->vector); if (cq->cqid) { diff --git a/hw/char/serial.c b/hw/char/serial.c index 62c627f486f..b8d5a1e9972 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -940,10 +940,8 @@ static void serial_unrealize(DeviceState *dev) =20 qemu_chr_fe_deinit(&s->chr, false); =20 - timer_del(s->modem_status_poll); timer_free(s->modem_status_poll); =20 - timer_del(s->fifo_timeout_timer); timer_free(s->fifo_timeout_timer); =20 fifo8_destroy(&s->recv_fifo); diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index cf08ef97281..b20038991a6 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -741,7 +741,6 @@ static void virtio_serial_post_load_timer_cb(void *opaq= ue) } } g_free(s->post_load->connected); - timer_del(s->post_load->timer); timer_free(s->post_load->timer); g_free(s->post_load); s->post_load =3D NULL; @@ -1138,7 +1137,6 @@ static void virtio_serial_device_unrealize(DeviceStat= e *dev) g_free(vser->ports_map); if (vser->post_load) { g_free(vser->post_load->connected); - timer_del(vser->post_load->timer); timer_free(vser->post_load->timer); g_free(vser->post_load); } diff --git a/hw/ide/core.c b/hw/ide/core.c index e85821637c9..b49e4cfbc6c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2716,7 +2716,6 @@ void ide_init2(IDEBus *bus, qemu_irq irq) =20 void ide_exit(IDEState *s) { - timer_del(s->sector_write_timer); timer_free(s->sector_write_timer); qemu_vfree(s->smart_selftest_data); qemu_vfree(s->io_buffer); diff --git a/hw/input/hid.c b/hw/input/hid.c index 89239b5634d..e1d2e460837 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -88,7 +88,6 @@ static void hid_idle_timer(void *opaque) static void hid_del_idle_timer(HIDState *hs) { if (hs->idle_timer) { - timer_del(hs->idle_timer); timer_free(hs->idle_timer); hs->idle_timer =3D NULL; } diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 1c8be40d8b4..3ada22f4270 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -888,7 +888,6 @@ static void apic_unrealize(DeviceState *dev) { APICCommonState *s =3D APIC(dev); =20 - timer_del(s->timer); timer_free(s->timer); local_apics[s->id] =3D NULL; } diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index a3021a4de16..264262959d5 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -474,7 +474,6 @@ static void ioapic_unrealize(DeviceState *dev) { IOAPICCommonState *s =3D IOAPIC_COMMON(dev); =20 - timer_del(s->delayed_ioapic_service_timer); timer_free(s->delayed_ioapic_service_timer); } =20 diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index c3f3306e66b..47c4676cc64 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -510,7 +510,6 @@ static void ipmi_bmc_extern_finalize(Object *obj) { IPMIBmcExtern *ibe =3D IPMI_BMC_EXTERN(obj); =20 - timer_del(ibe->extern_timer); timer_free(ibe->extern_timer); } =20 diff --git a/hw/net/e1000.c b/hw/net/e1000.c index d7d05ae30af..d8da2f6528b 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1647,11 +1647,8 @@ pci_e1000_uninit(PCIDevice *dev) { E1000State *d =3D E1000(dev); =20 - timer_del(d->autoneg_timer); timer_free(d->autoneg_timer); - timer_del(d->mit_timer); timer_free(d->mit_timer); - timer_del(d->flush_queue_timer); timer_free(d->flush_queue_timer); qemu_del_nic(d->nic); } diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 095c01ebc60..4dcb92d966b 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -434,23 +434,16 @@ e1000e_intrmgr_pci_unint(E1000ECore *core) { int i; =20 - timer_del(core->radv.timer); timer_free(core->radv.timer); - timer_del(core->rdtr.timer); timer_free(core->rdtr.timer); - timer_del(core->raid.timer); timer_free(core->raid.timer); =20 - timer_del(core->tadv.timer); timer_free(core->tadv.timer); - timer_del(core->tidv.timer); timer_free(core->tidv.timer); =20 - timer_del(core->itr.timer); timer_free(core->itr.timer); =20 for (i =3D 0; i < E1000E_MSIX_VEC_NUM; i++) { - timer_del(core->eitr[i].timer); timer_free(core->eitr[i].timer); } } @@ -3355,7 +3348,6 @@ e1000e_core_pci_uninit(E1000ECore *core) { int i; =20 - timer_del(core->autoneg_timer); timer_free(core->autoneg_timer); =20 e1000e_intrmgr_pci_unint(core); diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c index ccc3fce2a00..95d27102aa4 100644 --- a/hw/net/pcnet-pci.c +++ b/hw/net/pcnet-pci.c @@ -183,7 +183,6 @@ static void pci_pcnet_uninit(PCIDevice *dev) PCIPCNetState *d =3D PCI_PCNET(dev); =20 qemu_free_irq(d->state.irq); - timer_del(d->state.poll_timer); timer_free(d->state.poll_timer); qemu_del_nic(d->state.nic); } diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index ba5ace1ab75..4675ac878e9 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -3338,7 +3338,6 @@ static void pci_rtl8139_uninit(PCIDevice *dev) =20 g_free(s->cplus_txbuffer); s->cplus_txbuffer =3D NULL; - timer_del(s->timer); timer_free(s->timer); qemu_del_nic(s->nic); } diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 581320a0e7d..10e85a45560 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -363,7 +363,6 @@ static void spapr_vlan_instance_finalize(Object *obj) } =20 if (dev->rxp_timer) { - timer_del(dev->rxp_timer); timer_free(dev->rxp_timer); } } diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 044ac95f6f2..bfbfee3bf27 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1869,7 +1869,6 @@ static void virtio_net_rsc_cleanup(VirtIONet *n) g_free(seg); } =20 - timer_del(chain->drain_timer); timer_free(chain->drain_timer); QTAILQ_REMOVE(&n->rsc_chains, chain, next); g_free(chain); @@ -2652,7 +2651,6 @@ static void virtio_net_del_queue(VirtIONet *n, int in= dex) =20 virtio_del_queue(vdev, index * 2); if (q->tx_timer) { - timer_del(q->tx_timer); timer_free(q->tx_timer); q->tx_timer =3D NULL; } else { diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index d9e1e29f1e2..a5da3a11a17 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -953,7 +953,6 @@ void pci_dereg_ioat(S390PCIIOMMU *iommu) void fmb_timer_free(S390PCIBusDevice *pbdev) { if (pbdev->fmb_timer) { - timer_del(pbdev->fmb_timer); timer_free(pbdev->fmb_timer); pbdev->fmb_timer =3D NULL; } diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 1842c037978..b3029b392c6 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2132,7 +2132,6 @@ static void sd_instance_finalize(Object *obj) { SDState *sd =3D SD_CARD(obj); =20 - timer_del(sd->ocr_power_timer); timer_free(sd->ocr_power_timer); } =20 diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 2f8b74a84f7..8ffa53999d8 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1330,9 +1330,7 @@ void sdhci_initfn(SDHCIState *s) =20 void sdhci_uninitfn(SDHCIState *s) { - timer_del(s->insert_timer); timer_free(s->insert_timer); - timer_del(s->transfer_timer); timer_free(s->transfer_timer); =20 g_free(s->fifo_buffer); diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 40c1f906942..e35813d7722 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -576,7 +576,6 @@ static void usb_hub_unrealize(USBDevice *dev) &s->ports[i].port); } =20 - timer_del(s->port_timer); timer_free(s->port_timer); } =20 diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index ae7f20c502a..aca018d8b5f 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2534,7 +2534,6 @@ void usb_ehci_unrealize(EHCIState *s, DeviceState *de= v) trace_usb_ehci_unrealize(); =20 if (s->frame_timer) { - timer_del(s->frame_timer); timer_free(s->frame_timer); s->frame_timer =3D NULL; } diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c index f95199e0bbc..8e1146b8627 100644 --- a/hw/usb/hcd-ohci-pci.c +++ b/hw/usb/hcd-ohci-pci.c @@ -97,7 +97,6 @@ static void usb_ohci_exit(PCIDevice *dev) usb_bus_release(&s->bus); } =20 - timer_del(s->eof_timer); timer_free(s->eof_timer); } =20 diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 27ca237d71f..5969eb86b31 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1283,7 +1283,6 @@ static void usb_uhci_exit(PCIDevice *dev) trace_usb_uhci_exit(); =20 if (s->frame_timer) { - timer_del(s->frame_timer); timer_free(s->frame_timer); s->frame_timer =3D NULL; } diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 9ce7ca706e3..46212b1e695 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3395,7 +3395,6 @@ static void usb_xhci_unrealize(DeviceState *dev) } =20 if (xhci->mfwrap_timer) { - timer_del(xhci->mfwrap_timer); timer_free(xhci->mfwrap_timer); xhci->mfwrap_timer =3D NULL; } diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 3238de6bb82..44606b0047f 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1480,7 +1480,6 @@ static void usbredir_unrealize(USBDevice *udev) qemu_bh_delete(dev->chardev_close_bh); qemu_bh_delete(dev->device_reject_bh); =20 - timer_del(dev->attach_timer); timer_free(dev->attach_timer); =20 usbredir_cleanup_device_queues(dev); diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 342054193b3..42d67e870b7 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -186,7 +186,6 @@ static void vfio_display_edid_exit(VFIODisplay *dpy) =20 g_free(dpy->edid_regs); g_free(dpy->edid_blob); - timer_del(dpy->edid_link_timer); timer_free(dpy->edid_link_timer); } =20 diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c index 5b2ebf34961..4ad6e234adf 100644 --- a/hw/virtio/vhost-vsock-common.c +++ b/hw/virtio/vhost-vsock-common.c @@ -151,7 +151,6 @@ static void vhost_vsock_common_post_load_timer_cleanup(= VHostVSockCommon *vvc) return; } =20 - timer_del(vvc->post_load_timer); timer_free(vvc->post_load_timer); vvc->post_load_timer =3D NULL; } diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index e83017c02df..e7709551767 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -204,7 +204,6 @@ static bool balloon_stats_enabled(const VirtIOBalloon *= s) static void balloon_stats_destroy_timer(VirtIOBalloon *s) { if (balloon_stats_enabled(s)) { - timer_del(s->stats_timer); timer_free(s->stats_timer); s->stats_timer =3D NULL; s->stats_poll_interval =3D 0; diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 2886c0ce2a6..76ce9376931 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -233,7 +233,6 @@ static void virtio_rng_device_unrealize(DeviceState *de= v) VirtIORNG *vrng =3D VIRTIO_RNG(dev); =20 qemu_del_vm_change_state_handler(vrng->vmstate); - timer_del(vrng->rate_limit_timer); timer_free(vrng->rate_limit_timer); virtio_del_queue(vdev, 0); virtio_cleanup(vdev); diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c index 4c4b6a6ab70..e135a4de8b2 100644 --- a/hw/watchdog/wdt_diag288.c +++ b/hw/watchdog/wdt_diag288.c @@ -110,7 +110,6 @@ static void wdt_diag288_unrealize(DeviceState *dev) { DIAG288State *diag288 =3D DIAG288(dev); =20 - timer_del(diag288->timer); timer_free(diag288->timer); } =20 diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 502f45a9399..4c52e3bb9e1 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -454,7 +454,6 @@ static void i6300esb_exit(PCIDevice *dev) { I6300State *d =3D WATCHDOG_I6300ESB_DEVICE(dev); =20 - timer_del(d->timer); timer_free(d->timer); } =20 diff --git a/migration/colo.c b/migration/colo.c index 3f1d3dfd956..de27662cab5 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -636,7 +636,6 @@ out: * error. */ colo_compare_unregister_notifier(&packets_compare_notifier); - timer_del(s->colo_delay_timer); timer_free(s->colo_delay_timer); qemu_event_destroy(&s->colo_checkpoint_event); =20 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 65d8ff48494..17b21197b81 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1586,7 +1586,6 @@ static void hmp_migrate_status_cb(void *opaque) error_report("%s", info->error_desc); } monitor_resume(status->mon); - timer_del(status->timer); timer_free(status->timer); g_free(status); } diff --git a/net/announce.c b/net/announce.c index db90d3bd4b9..26f057f5ee4 100644 --- a/net/announce.c +++ b/net/announce.c @@ -41,7 +41,6 @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool f= ree_named) { bool free_timer =3D false; if (timer->tm) { - timer_del(timer->tm); timer_free(timer->tm); timer->tm =3D NULL; } diff --git a/net/colo-compare.c b/net/colo-compare.c index 337025b44f8..84db4978ac3 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -951,7 +951,6 @@ static void colo_compare_timer_init(CompareState *s) static void colo_compare_timer_del(CompareState *s) { if (s->packet_check_timer) { - timer_del(s->packet_check_timer); timer_free(s->packet_check_timer); s->packet_check_timer =3D NULL; } diff --git a/net/slirp.c b/net/slirp.c index 77042e6df74..8350c6d45f7 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -184,7 +184,6 @@ static void *net_slirp_timer_new(SlirpTimerCb cb, =20 static void net_slirp_timer_free(void *timer, void *opaque) { - timer_del(timer); timer_free(timer); } =20 diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index 1d6a9684060..5ec574724a2 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -78,7 +78,6 @@ static void replay_delete_break(void) assert(replay_mutex_locked()); =20 if (replay_break_timer) { - timer_del(replay_break_timer); timer_free(replay_break_timer); replay_break_timer =3D NULL; } diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 8a734c2f8c0..7da70afbf22 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -313,9 +313,7 @@ static void s390_cpu_finalize(Object *obj) #if !defined(CONFIG_USER_ONLY) S390CPU *cpu =3D S390_CPU(obj); =20 - timer_del(cpu->env.tod_timer); timer_free(cpu->env.tod_timer); - timer_del(cpu->env.cpu_timer); timer_free(cpu->env.cpu_timer); =20 qemu_unregister_reset(s390_cpu_machine_reset_cb, cpu); diff --git a/ui/console.c b/ui/console.c index 30e70be555d..2625a65c29c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -253,7 +253,6 @@ static void gui_setup_refresh(DisplayState *ds) timer_mod(ds->gui_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); } if (!need_timer && ds->gui_timer !=3D NULL) { - timer_del(ds->gui_timer); timer_free(ds->gui_timer); ds->gui_timer =3D NULL; } diff --git a/ui/spice-core.c b/ui/spice-core.c index eea52f53899..5746d0aae7c 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -76,7 +76,6 @@ static void timer_cancel(SpiceTimer *timer) =20 static void timer_remove(SpiceTimer *timer) { - timer_del(timer->timer); timer_free(timer->timer); g_free(timer); } diff --git a/util/throttle.c b/util/throttle.c index b38e742da53..81f247a8d18 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -247,7 +247,6 @@ static void throttle_timer_destroy(QEMUTimer **timer) { assert(*timer !=3D NULL); =20 - timer_del(*timer); timer_free(*timer); *timer =3D NULL; } --=20 2.20.1 From nobody Tue Nov 18 02:49:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608071276; cv=none; d=zohomail.com; s=zohoarc; b=VTolOeg0dxxqbU5GJGIS5zXym2opDIz7Uo2Lu/EgJuvrJYFcy1WkveIbYmdN9cI4MnGc1qGNyktEMdunAnfxvDUvZlIN9PVAOahUn7xiTK3xkRNJ8JMvyrXRmvO4PvEC1dYXbba6/7Ng2V26LarhEcRMMamLXC1aueVcNG0PIs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608071276; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kWg1+cYYQc9yalbndq1Q+pROpZyG/S73S5WbiG4BpFk=; b=WhLplRhOlHgwamWVCHJCpAYOK2lYPUg/Pge8AX5v5AlYWV5c4dLjInbn1Oh+t7SLE1fSqx9WG/QYtovBuZLoyArGSJsivzbIyF6MOBSyHFwClhVhyaDiKESoKy49HadjIX0N7KnJ8vIxT+hV42XyQBxiwMO8mIGmK9WzuhH5gus= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608071276568382.0259594368043; Tue, 15 Dec 2020 14:27:56 -0800 (PST) Received: from localhost ([::1]:38030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpCbM-0005Ju-CZ for importer@patchew.org; Tue, 15 Dec 2020 10:51:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpCRy-0003VH-0I for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:18 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:50311) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpCRw-0004uR-FP for qemu-devel@nongnu.org; Tue, 15 Dec 2020 10:41:17 -0500 Received: by mail-wm1-x344.google.com with SMTP id 190so7044829wmz.0 for ; Tue, 15 Dec 2020 07:41:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 34sm38259978wrh.78.2020.12.15.07.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 07:41:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kWg1+cYYQc9yalbndq1Q+pROpZyG/S73S5WbiG4BpFk=; b=RoC4eNBkcMlp/083JbdOkrzB1X+Cli7srDhrDdI2IrObReko+QgSvZp0q4zMYg6tTN qs3+Dsoa36+nuCayYXOMWENy3jvqkrkhziJhDy/6bFjxYnn5neAVFq16BLuhSJ6HOA+Q zyNtA36FrGPTqSVBlnZ1Jtj9LPsi8YD/h1T8YAtQgamtaqCJxSsaUwEcTaSmEmO5o/fv 43OWrWzmicCAIV2FeLNDYsJfHG8x4NV5M9bDsaKwzp+FtFdr14Q9AsXOrxrxAkwZIrJ8 dS/eAyORDJkOKOLRcCPSqdiE8B5iFqDGonicz9tZOfF3QxzALd8AOmSJE77GbNn6Bs8x 2ihw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kWg1+cYYQc9yalbndq1Q+pROpZyG/S73S5WbiG4BpFk=; b=UVxvywk6mkRMQfmcXxNTWxFKWu07TeZIexh1C4sTZKVg7tOhuPScs9SRmN/UyoIFnJ DpdQmdV6XoNNHYq2LqEOb9PwKrhkYn1fokufEpOWqrtAk7AW5uWllWJ3g5tUSGJTFlqU TRBLoIac+LbeJ57qmur2HAytkKZIny7Feb2R180GLNgXX+KNKbwqg4SdmPOBQWUgNOl3 427pOjuuSMh34E5pZZDu1AmrNPDFG9QVX940v1l4J97RJqj+30l4xhn0ZyzXVSkFuX72 GEkSpLbsHvnsaBXVPcPnsqPRik2vqCHPMw+lP8YVW1VEr3AT2NX9vuf84yL37mN6lnT6 2psw== X-Gm-Message-State: AOAM532sRZN3jb+CV0f9qOrtbkyKXxscFybOp43PZsWLyr7V9gcLXqaz DdUhACU4wjKMpFsEAeo88504A9lApvpQzQ== X-Google-Smtp-Source: ABdhPJzY0RrY5AnUkrV7+k9jibXdVtEYU8uX9aIUUu6TWhEX6W0qtUDS+31520gdQ5ltWf3Cw3GWIw== X-Received: by 2002:a1c:df85:: with SMTP id w127mr34275093wmg.166.1608046874858; Tue, 15 Dec 2020 07:41:14 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 4/4] target/arm: Remove timer_del()/timer_deinit() before timer_free() Date: Tue, 15 Dec 2020 15:41:07 +0000 Message-Id: <20201215154107.3255-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201215154107.3255-1-peter.maydell@linaro.org> References: <20201215154107.3255-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- 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 --=20 2.20.1