From patchwork Tue Nov 21 17:40:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 745720 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp2014002wrt; Tue, 21 Nov 2023 09:42:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7ap5PS98q002/8haMSSClp1u3p093h8H0enOZwU6vH4Q/lhiptgCPsA2lZo6VtUIhCYbo X-Received: by 2002:a05:6359:7903:b0:16d:e5d0:60ed with SMTP id xc3-20020a056359790300b0016de5d060edmr5162645rwb.23.1700588522047; Tue, 21 Nov 2023 09:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588522; cv=none; d=google.com; s=arc-20160816; b=dm/fq9GzMpz8hM5Dwfs3PXyT8YdtIrrsvidDmi+q7GMMHuJ7aExZng0lbVRqcJtmFS eKOMNXCjFg2dk2mEQTGKOoJFh2BrLgO1amgdfMtTaTU1bh3gansfAhGr21i+dw9SNHwP VX//G0sc5WrQvgBG5AUKGHHkej/vv6cu9M/A7euW4r8+Q5rUhGJ1TwDLQ50fo5mB2HPT G+zWEgC32dilbaeIdxd0PEUukXiOkZGKrb+4SQnY/Z//i66Pqpq34QlV8+dQS76Ne/Qf tUjwxM4JZ4DiOEKdNlNU0bmclso/LzRN1HbC9UEZjO2xskIwsM/WuVJqwIzLfAVE0Ot4 sqjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oSzcSfZwgHqAqG/jf8MlqCJk5iiUJb969eq9bTdsPE4=; fh=m9pdibqEaBwE4nbZ1bdBlX5QKqVA9BdvTndDUPs5mJs=; b=Uc9QYClerreeNTmbbhI4HmlgnQYe43NYvS8Ef25hFW9Ah4v1BTV7epny/Si1JAKbpB AIQsnH2WrFo1b1xJTtKolzlM5AarimTD4Jz8qZ5Pd5QHVbXb2Afv6suuVTYvyfVFWzA6 PsEZ8TsL86A8mFTEyuOcwfhMLeDYdEl0B3khG+5gh4iVJUwiaCfN1XADcEU3i4GhgVKJ LXVfFULPqQZt9Xq0zFaMV3DrfNQx6LgwhKbjpM7ZZnluwUSSro2gMELVacpAeLI0Reer wzrPV4Z+D3c3hG0DcPYMHJ3m5tEl6LIky4zu2AAeShhIrGgKrKCM5jxIif+J1GwQw65G Gkmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GFuKUxhx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w1-20020a9f2c81000000b007b36db876e8si2187169uaj.8.2023.11.21.09.42.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 09:42:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GFuKUxhx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5UkG-0008B4-9e; Tue, 21 Nov 2023 12:41:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5UkE-0008A6-0m for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:06 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5UkA-0001ER-Eg for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:05 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32f78dcf036so3359f8f.0 for ; Tue, 21 Nov 2023 09:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700588460; x=1701193260; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oSzcSfZwgHqAqG/jf8MlqCJk5iiUJb969eq9bTdsPE4=; b=GFuKUxhxONE592zXAIqk4Os/oFfLk/w1jFlA69hJqdsFDSQoaPe9ew1fZFihv/wfnI My0L3boIgY7ipzt2hcnXn2JcU055Z2AG7etvYWnR8hvghLghGvWmZGU3T8RGy6CR5RJe YYXuiG7ItI8hpv0HIIVcKptuT1tn+YO2e72I5zBu1ZqCEJdyGNFdHWeWwS8KGGdtXA4A 1LoMpAMwuEx4W2w/n5F4H1ccbYjYLj2HEbl3D8PeO3y4kYE1o1fVyu35HSqpYObLaQf9 /F+Ghw/kPBmR/5zBpPy4vA6AcMcKAaEUX2/oaiQRg23xYp0eY5h/VPA5I3MT1Sbx5R3Y 74iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700588460; x=1701193260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oSzcSfZwgHqAqG/jf8MlqCJk5iiUJb969eq9bTdsPE4=; b=ssVWmvb1qo8MTHxAHx/D7MoICtuPCtdc6JbOF12Lrqld9h5+2+8i7HPjpNzsdggM6u sTqnPQDdu/YT89GZALepgNaHN4fDOlXiR3fL2RY8hXdwYDOrQrHHbDnB34Gt9d36HWmn 7d3xDTMAOaWJG6K+QZXZqEI7nP5xZeec6X1i/IOJTdlzZmLElRRklpEGNl6jpJp7Bg34 PdqhSOdTBtT7gDjGv9ARaex48Txo2tOOiF5TiosuqYbUBjZWc3R/ebyE72CUd9ZfvUa8 F0DG0kSD46M0ZsIP+C5e+dSbde7f4jjFVjFtYlrJeBMG1R3tYMcwkoAKfpUunIP2zzib s3Bw== X-Gm-Message-State: AOJu0YxUXmCo9datIrhSYa8AwD4EnBFKM8+Q5/bTjeueu3NCjMY2F+xg qqP+qHO03FHmOpLzc9M2r4LsQ4e7PQRdtuKDRoI= X-Received: by 2002:a5d:6dad:0:b0:332:c593:16e with SMTP id u13-20020a5d6dad000000b00332c593016emr60270wrs.18.1700588460255; Tue, 21 Nov 2023 09:41:00 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-219.dsl.sta.abo.bbox.fr. [176.184.8.219]) by smtp.gmail.com with ESMTPSA id x5-20020adfffc5000000b0032fb17c65desm14961264wrs.19.2023.11.21.09.40.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Nov 2023 09:40:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Kevin Wolf , "Edgar E. Iglesias" , Eric Auger , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.2? 1/6] hw/virtio: Add VirtioPCIDeviceTypeInfo::instance_finalize field Date: Tue, 21 Nov 2023 18:40:46 +0100 Message-ID: <20231121174051.63038-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121174051.63038-1-philmd@linaro.org> References: <20231121174051.63038-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The VirtioPCIDeviceTypeInfo structure, added in commit a4ee4c8baa ("virtio: Helper for registering virtio device types") got extended in commit 8ea90ee690 ("virtio: add class_size") with the @class_size field. Do similarly with the @instance_finalize field. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/virtio/virtio-pci.h | 1 + hw/virtio/virtio-pci.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h index 5a3f182f99..59d88018c1 100644 --- a/include/hw/virtio/virtio-pci.h +++ b/include/hw/virtio/virtio-pci.h @@ -246,6 +246,7 @@ typedef struct VirtioPCIDeviceTypeInfo { size_t instance_size; size_t class_size; void (*instance_init)(Object *obj); + void (*instance_finalize)(Object *obj); void (*class_init)(ObjectClass *klass, void *data); InterfaceInfo *interfaces; } VirtioPCIDeviceTypeInfo; diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 205dbf24fb..e433879542 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2391,6 +2391,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t) .parent = t->parent ? t->parent : TYPE_VIRTIO_PCI, .instance_size = t->instance_size, .instance_init = t->instance_init, + .instance_finalize = t->instance_finalize, .class_size = t->class_size, .abstract = true, .interfaces = t->interfaces, From patchwork Tue Nov 21 17:40:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 745721 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp2014073wrt; Tue, 21 Nov 2023 09:42:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFo5b0qBbiqXb8xo+ffWHMoAGlLFLW+ampbOE39t7ntX5GWj5EXExqu9tXnRZtzgmJjq/NM X-Received: by 2002:a05:6214:29c9:b0:66d:46ac:2fbf with SMTP id gh9-20020a05621429c900b0066d46ac2fbfmr11562375qvb.14.1700588533035; Tue, 21 Nov 2023 09:42:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588533; cv=none; d=google.com; s=arc-20160816; b=NN+18H/BuvZDzsQcl69UFvbQEGRBMblbmYHY2VKnPEqTNmYnR21mueo0SI5q7EJVtx XHVfwp0zuvnP9tg//nvIYI52rj5KpO+ZVr83P7ZYJQMooNVe6BaEWdVvIxCedR1uT/BE 2G5ftbSwCfvwXvAm24aHuUUafBR7KzPUbsdIHN716kayHDCGo+5Yci1ckhbqJEI1KcIK GFWlDdYEB6c8vI8Aof91t/qeVjYc8MeS8COwseJomSkIdMUD+9s9AojcicW+FQP5reOt lBgSj6b23PQiR4MdKLhQXqAeYjvEnUaCoMbO0dDjNf452TFtHqVnm4ASBFvA/rstTxKT gUqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7clgUrwYfFvC52qM6G31UyIfG1h1zTHGo1j4Nprhx9Y=; fh=cL0kZojwLp2/+GG3A9WvbPyWHrvsxnhr8acLawhZl1M=; b=H6WDNxWRMDTzQP4nrbB5Hb1EvbUclTKJh3H9uTrMPwFOBLLCLSCw1LrZctH6agnqfw sYhBmlunJ/2fdWZBvJ/yPK2t8Cpc/rVEu5bH2PRl7C4B4vV8+1xrnvlvT8bcPoHsBTHo C7ZruXa0NQRLMY1zzQfG97jslswlj81Bxt/FK1ga+54PcqFjfRk5R/OuxuuzyEkzKP8L 6RLflS93nJzI4DpopL6gkjltZ/UTgB+MdQGV/H9vDhKsdaqjxqelM2HtqQr8gtfas33t 7qLivgIS4WlBKvcH14dYm+TjHuJepKFrdebbKe9Vm44TABxqc4rRAFFE8PgJINeGKCrq 4ZcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WxNqJo97; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ey10-20020a0562140b6a00b00679df2fb939si3992229qvb.15.2023.11.21.09.42.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 09:42:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WxNqJo97; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5UkJ-0008CP-89; Tue, 21 Nov 2023 12:41:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5UkH-0008BM-9I for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:09 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5UkF-0001F9-Au for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:09 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-332cc1f176bso1048023f8f.2 for ; Tue, 21 Nov 2023 09:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700588466; x=1701193266; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7clgUrwYfFvC52qM6G31UyIfG1h1zTHGo1j4Nprhx9Y=; b=WxNqJo97gUwNfvU3T7dZZh3Sn7eXvfPtmQ3EMHu513H7pEu9CcaQFGlwwMjGMe50n9 3ry5sUp8uvFrHU331/s/a2uYNTOlZONmrsohUBYXTmTA6suE0gszJ0Q52U5UKvXhjQfc 4NQFhbuK27YWyPoeXBjRCjkSBYLC0GRXDD1wBCOmSO05SqfL7H98/HtPDOPdmDh1IUCM GC1AEd6F7lWGmRAO+mEwr3QOFeaJJn02D7a/S47c8PlUrsXbQAT6YQwmGkOQ9cIyVylc D4vAXoaFJVWo3if2YUTBhD44fYLlQZN1o8b91Wucv2oEa8TYlwkeQDF4ODA1X73m3Lq6 X5NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700588466; x=1701193266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7clgUrwYfFvC52qM6G31UyIfG1h1zTHGo1j4Nprhx9Y=; b=dKTYSEXm3qN1njM5g3i9QsoYmPLeQvccDqyWwOB+J7/wP7S9VnKYzJGGPOyHz3apyP H4aj2UNrmkCrONp3Drxu7tALVp8QWLsORKWXoEpspod8El0yr+yn+L3ZPWBgprDyzAVG KmC23kJmc+VSc3Rzom8u0/XmKtW2KPF02oEgKNhqPstLWOUquzOCh7XNhHRuLXwKIJgT 1IpUBf1fUNy0xWDMjS3xvDXBzgnwr6+h+VpwuvnMplNYadB2v/SP70fi4p/RPv28MfsY mwffEM6IV5q2cnTPe4IXYZaQbc2O7vmZomT5E/dz21Zqamb9mvr1ufQE3XMjx9wWnKqF UC4Q== X-Gm-Message-State: AOJu0YxfE4+XaZHbBwylxLrlAEf+J1k9nZoagxutQInL+Vpf2goXphFa /ws8nrmiif7YxtVmKQP7TCuC1j5PejQ5L++5cN8= X-Received: by 2002:adf:f291:0:b0:331:338c:c74d with SMTP id k17-20020adff291000000b00331338cc74dmr5864753wro.70.1700588465831; Tue, 21 Nov 2023 09:41:05 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-219.dsl.sta.abo.bbox.fr. [176.184.8.219]) by smtp.gmail.com with ESMTPSA id m5-20020a5d6a05000000b0032d2489a399sm14777202wru.49.2023.11.21.09.41.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Nov 2023 09:41:05 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Kevin Wolf , "Edgar E. Iglesias" , Eric Auger , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH-for-8.2? 2/6] hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize() Date: Tue, 21 Nov 2023 18:40:47 +0100 Message-ID: <20231121174051.63038-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121174051.63038-1-philmd@linaro.org> References: <20231121174051.63038-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit 0be6bfac62 ("qdev: Implement variable length array properties") added the DEFINE_PROP_ARRAY() macro with the following comment: * It is the responsibility of the device deinit code to free the * @_arrayfield memory. Commit 8077b8e549 added: DEFINE_PROP_ARRAY("reserved-regions", VirtIOIOMMUPCI, vdev.nb_reserved_regions, vdev.reserved_regions, qdev_prop_reserved_region, ReservedRegion), but forgot to free the 'vdev.reserved_regions' array. Do it in the instance_finalize() handler. Cc: qemu-stable@nongnu.org Fixes: 8077b8e549 ("virtio-iommu-pci: Add array of Interval properties") # v5.1.0+ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger --- hw/virtio/virtio-iommu-pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 9459fbf6ed..cbdfe4c591 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -95,10 +95,18 @@ static void virtio_iommu_pci_instance_init(Object *obj) TYPE_VIRTIO_IOMMU); } +static void virtio_iommu_pci_instance_finalize(Object *obj) +{ + VirtIOIOMMUPCI *dev = VIRTIO_IOMMU_PCI(obj); + + g_free(dev->vdev.prop_resv_regions); +} + static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .generic_name = TYPE_VIRTIO_IOMMU_PCI, .instance_size = sizeof(VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init, + .instance_finalize = virtio_iommu_pci_instance_finalize, .class_init = virtio_iommu_pci_class_init, }; From patchwork Tue Nov 21 17:40:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 745725 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp2014618wrt; Tue, 21 Nov 2023 09:43:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWtO8eFlXSdydvfxYd3a0twVQW02Uqjr/Zn/m86VQrZeOuiWpbdtEW8byo/JV/4jRwvk9+ X-Received: by 2002:a05:622a:1007:b0:413:bd3:cda5 with SMTP id d7-20020a05622a100700b004130bd3cda5mr14013098qte.49.1700588600041; Tue, 21 Nov 2023 09:43:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588600; cv=none; d=google.com; s=arc-20160816; b=rav+HXPPFauZSE3kC7EukOX/V/VvYqMFl0pyLMOG+ty1kzZeoTnITyt4CzY7m7Lu5I lK+YGr/Q8JwUZq04LXwJ19UErOyduzlRHKAY5yMVBA5nEQTPhbejRmaXHSEtEvmEpotQ 9Ba2KiK7gxSndDyDTxe/inLWlFxL3rg+hrkVexn/uQnaMiY2Ej4b6GtArsMVNcGH3nUE j6UDLWpnGkENDmqQbWrualagm6rMraQPpufx4JrfoN41yY6rZEDQ4JXYiuf1q1M2URcH 7ieD2hqSD9mzu0dTxBoE6b2InUgvkDy4qmPZkjXguIr5cJyYRZgQDxANf3TeL9UU2Ggm i4dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3gZmZAr8kYS7gDEfj38KOIHMYLXNb4HUKsj/RIzSduo=; fh=cL0kZojwLp2/+GG3A9WvbPyWHrvsxnhr8acLawhZl1M=; b=qfk+4caCWtYbBX/Yrrg74p7sJjXaTJlJLxItejbPsCZcnZvGvrmVacVOJtBR+w7fZ/ 2uAKrGVAi1k1Y0Vh9HRSEZ1arZ+4LPD+LriSm+xXPoChdKh7qyl+DUP8ebPqOWqHdovf JYrMH9iOo71CwCvTx2rYfGFnJ47mzhOYghy/+nL4joNsanuo6JfIpx6uRI1VD9MWUImt 0AD/ElZUDekuiaRCH6/EcNFRSaDCKbnHwtfiJmP7psBxGFjEqQFWsFTY9j/oELLo+Il6 PGRy12uR3rYngNonU8ukOkPC8LCx6JjAouW+zuQNZPwH1cnsnl19rD48oiocMVoLxo4I qQbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dVISFH7i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b13-20020ac87fcd000000b004219c4d39e2si9637557qtk.225.2023.11.21.09.43.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 09:43:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dVISFH7i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5UkP-0008E4-3y; Tue, 21 Nov 2023 12:41:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5UkN-0008Da-DM for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:15 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5UkK-0001Fv-Pg for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:15 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32fdc5be26dso3738824f8f.2 for ; Tue, 21 Nov 2023 09:41:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700588471; x=1701193271; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3gZmZAr8kYS7gDEfj38KOIHMYLXNb4HUKsj/RIzSduo=; b=dVISFH7i4vWRLm5MJo0BMF6C4zd0M6+80ab3QY/OpMuxVRV7GOihYzV4xrz85dNMay JaFUIUnKnxQbPEBO90p3AUAXCCYFsJ3+qFKr455/MiEUCIyJ67S4dgDu2PwKEHqpxzLn D2vHJfYOcu9Z6BQiCHKO95jE9b/SBsfyY7pHBw1egPvGGr/icfpOnRLESzfRr1eF7wuR SdiuByVoQWhZWqneEMvpkGdvUAyIinlJ5vSMOAcIzFvZlmB8Qhn5I7KmvqV8yzHKTjRe 7K1mF05LBvM4acwNmYLUFDlitCQ8pIsuSlABNoRy0BzQ2e6cYr1vbpfATD7slWCJF7x1 melg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700588471; x=1701193271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3gZmZAr8kYS7gDEfj38KOIHMYLXNb4HUKsj/RIzSduo=; b=Se3nGK0mTNqKcLE9BY2mxS6TUUaFg6OEzO8dg8Lj+Lqpz2lPwt4Vs1SjmzFzLUB96O CjTg1OG8Q7vTRIUBixF5+6Cy7/b4MCHgG6d4Mublv9jLztKdfL5mUf0f5IPGeaaMcQam Y66HIXu+WCGNz/5dba1BDUubYBm1PcC+AsjrSySB3QkiajVmrIeAguJrNB4jfAJLjX8B C5svoN6yiIn5P4PnmtD/MyWJ0ZRi3QehjdTTLa3J87VRw8S8AhTBLEi0k/oW7wtRzuEv ZV/HH919kk3mVBcgCBd1+QuiEYuRVSuNGadlyUDOgmOgIStEfGyV7XWQoWGnFQNOLrnx 2JVQ== X-Gm-Message-State: AOJu0YwC+N1/5yUS6zy1V82R9iGeLLL5XxXCLqRYi3A7DsiBer/u8Q86 Kp1wYM7fzh7UNfHG6FJiWL8X+vWmirfOkOcf+Kg= X-Received: by 2002:a5d:64ec:0:b0:332:c9e7:3d1a with SMTP id g12-20020a5d64ec000000b00332c9e73d1amr4672410wri.62.1700588471330; Tue, 21 Nov 2023 09:41:11 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-219.dsl.sta.abo.bbox.fr. [176.184.8.219]) by smtp.gmail.com with ESMTPSA id m5-20020a5d6a05000000b0032d2489a399sm14777400wru.49.2023.11.21.09.41.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Nov 2023 09:41:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Kevin Wolf , "Edgar E. Iglesias" , Eric Auger , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH-for-8.2? 3/6] hw/misc/mps2-scc: Free MPS2SCC::oscclk[] array on finalize() Date: Tue, 21 Nov 2023 18:40:48 +0100 Message-ID: <20231121174051.63038-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121174051.63038-1-philmd@linaro.org> References: <20231121174051.63038-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit 0be6bfac62 ("qdev: Implement variable length array properties") added the DEFINE_PROP_ARRAY() macro with the following comment: * It is the responsibility of the device deinit code to free the * @_arrayfield memory. Commit 4fb013afcc added: DEFINE_PROP_ARRAY("oscclk", MPS2SCC, num_oscclk, oscclk_reset, qdev_prop_uint32, uint32_t), but forgot to free the 'oscclk_reset' array. Do it in the instance_finalize() handler. Cc: qemu-stable@nongnu.org Fixes: 4fb013afcc ("hw/misc/mps2-scc: Support configurable number of OSCCLK values") # v6.0.0+ Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/mps2-scc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c index b3b42a792c..fe5034db14 100644 --- a/hw/misc/mps2-scc.c +++ b/hw/misc/mps2-scc.c @@ -329,6 +329,13 @@ static void mps2_scc_realize(DeviceState *dev, Error **errp) s->oscclk = g_new0(uint32_t, s->num_oscclk); } +static void mps2_scc_finalize(Object *obj) +{ + MPS2SCC *s = MPS2_SCC(obj); + + g_free(s->oscclk_reset); +} + static const VMStateDescription mps2_scc_vmstate = { .name = "mps2-scc", .version_id = 3, @@ -385,6 +392,7 @@ static const TypeInfo mps2_scc_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MPS2SCC), .instance_init = mps2_scc_init, + .instance_finalize = mps2_scc_finalize, .class_init = mps2_scc_class_init, }; From patchwork Tue Nov 21 17:40:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 745724 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp2014325wrt; Tue, 21 Nov 2023 09:42:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IH65/3UgzoNb3RKPItg9p83WmdBJoCn6/yb+UJ0xddYXneXcOGacwn70XZ8dfWND8+WkxTM X-Received: by 2002:a05:620a:890a:b0:779:f544:a45f with SMTP id ql10-20020a05620a890a00b00779f544a45fmr13834949qkn.49.1700588562779; Tue, 21 Nov 2023 09:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588562; cv=none; d=google.com; s=arc-20160816; b=h7UMMIwSzxnzLQqrOrAtZgCb7bCoz+6PjEOtPKwmrjXp88c2TNUL/Nd+n7TB6ASYiV 0pwzlCR1g5oFnhnDHLS2ppFFVQNsIYONEk9hGG4v7sZPwWkayIju+iuLjPYC1cuhjRwV EhtI7Gz3qQnWwh8j/0mq5pSrWb1rIUeLmHvQnLOX9eIboY+0PF4u/78l9oLjTb2l6IWo UHu+laXjUsIUzrhCpbQZPgXFKWN3MOJAhp/JAYWXuiW2uemsQ/JZARHvV4jIVl2eGcou /4OP60UbprElmn5Pj4c83ClZnYj+g0WRyEqc1Iu2KHMNB9WpGpy++xJ2/hv0ShP+OUpo GQuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gXPnP9OotZkXe8sn/bINkpH4C8HDZjSGF7IOUTkUbPk=; fh=cL0kZojwLp2/+GG3A9WvbPyWHrvsxnhr8acLawhZl1M=; b=qjpiwo+u6yqJwpX2EBbz8yVtuPmMewfkEOEW1wkn1taTvGU8h0SSimQoA4Vg/+U2L2 rGoM0lQwl8qp8ANmK0AAapg9+qYUwqeec84nkfjMmoQCtcVBQ4iT4R4RTTDSHVS7gHxG XOSa1arIO6iB7iVuyH7iwtCdDI1FPOvvq/t4TQEc5D9SHlaMznAKX+IBlCI+HuU57kqA qnYHsbH1yEdQKz3FAXU/8hecFKDDDdKw88/K/yFROzGjgVewecOGGeVEdrU8aE2aYKYG YWCnnB8AbK1S7JzD1k2IYSXfsDLOaMPgML2WRb6JHhFwClf6wbTDCjcQ2o04kO9Md9dI XdnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pfCxfaM/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bi11-20020a05620a318b00b0076da7849687si10371999qkb.344.2023.11.21.09.42.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 09:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pfCxfaM/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5UkW-0008JW-VL; Tue, 21 Nov 2023 12:41:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5UkV-0008Gy-O0 for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:23 -0500 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5UkT-0001I6-0a for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:23 -0500 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2c5071165d5so72868311fa.0 for ; Tue, 21 Nov 2023 09:41:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700588477; x=1701193277; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gXPnP9OotZkXe8sn/bINkpH4C8HDZjSGF7IOUTkUbPk=; b=pfCxfaM/Iu4cjgXIz6vPbUyg3Xiuntw3jkcVU6Az9/mEJLI/Kd7Katklybn/Vx0xhc 8l9SaDCzDXKAx+f/0uUpdM3Qfxye1fKYXeDsGtjf9Q0qf2QC+iIWdGmg7fb3OT17Ksn0 peZqedRvrxtDH++swZa8ULdVJczFpr30yEJmDLGy8jadHR0G6OzFaNmiO0rXtXLfMpuF 3HJTplHXmyg7FB86KUacgD2ul7aoNFhnAJ97Io50KXVQDCneHhWplI6uMyxLgw9xhs07 Eq4F0z04lwFK70mWo6owotPCnmGRIFXAM5+bcmqzH++nt2GI0rSUlngkbMQ4fpc5KoEK 3CKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700588477; x=1701193277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gXPnP9OotZkXe8sn/bINkpH4C8HDZjSGF7IOUTkUbPk=; b=tvVkbJtUHY1SmzteHocdPkt7hegt+JLvE0k+8Rg08/hvwxSNuGCQhYX4BIc4fF0Z4R WUCb0nDEWkEJUNZbbgy3x5jHDin9ja0QsdaKaYcarR5RD0HWGC5NGy6MY10ep2GHpgnj j7KI2n6h/RAfzacUiaBHtJSO7gEemxbrhThvHmBxXbAk24ireyo3VKdbzuE+U63mw4x3 6sxu/aC84WzsmOW+jfQdZiiGwvm0whoCZUGRQc9SfbLM3iF0Wras1Q7nCaMcye4D07PJ SYAjbwaMZdk7n22HkTUFdz69FJr/NLuo+oL5yyZ4EWlXDFv0o/Y+IRi0Bb1P48NH18RJ oPlQ== X-Gm-Message-State: AOJu0YxPDhllJ87zKF4uFVwikNZ2cW5rUCvnph0dDr/fDSqNeJFjv2vD cMcLMZfF3dEeAAfiO06AeGw+HlbfdF3cQRX4uIY= X-Received: by 2002:a2e:9b95:0:b0:2c1:9a8b:f67 with SMTP id z21-20020a2e9b95000000b002c19a8b0f67mr6777111lji.1.1700588477006; Tue, 21 Nov 2023 09:41:17 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-219.dsl.sta.abo.bbox.fr. [176.184.8.219]) by smtp.gmail.com with ESMTPSA id q3-20020a05600c46c300b0040b2b9bf321sm1973474wmo.9.2023.11.21.09.41.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Nov 2023 09:41:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Kevin Wolf , "Edgar E. Iglesias" , Eric Auger , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH-for-8.2? 4/6] hw/nvram/xlnx-efuse: Free XlnxEFuse::ro_bits[] array on finalize() Date: Tue, 21 Nov 2023 18:40:49 +0100 Message-ID: <20231121174051.63038-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121174051.63038-1-philmd@linaro.org> References: <20231121174051.63038-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit 0be6bfac62 ("qdev: Implement variable length array properties") added the DEFINE_PROP_ARRAY() macro with the following comment: * It is the responsibility of the device deinit code to free the * @_arrayfield memory. Commit 68fbcc344e added: DEFINE_PROP_ARRAY("read-only", XlnxEFuse, ro_bits_cnt, ro_bits, qdev_prop_uint32, uint32_t), but forgot to free the 'ro_bits' array. Do it in the instance_finalize handler. Cc: qemu-stable@nongnu.org Fixes: 68fbcc344e ("hw/nvram: Introduce Xilinx eFuse QOM") # v6.2.0+ Signed-off-by: Philippe Mathieu-Daudé --- hw/nvram/xlnx-efuse.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c index 655c40b8d1..f7b849f7de 100644 --- a/hw/nvram/xlnx-efuse.c +++ b/hw/nvram/xlnx-efuse.c @@ -224,6 +224,13 @@ static void efuse_realize(DeviceState *dev, Error **errp) } } +static void efuse_finalize(Object *obj) +{ + XlnxEFuse *s = XLNX_EFUSE(obj); + + g_free(s->ro_bits); +} + static void efuse_prop_set_drive(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -280,6 +287,7 @@ static const TypeInfo efuse_info = { .name = TYPE_XLNX_EFUSE, .parent = TYPE_DEVICE, .instance_size = sizeof(XlnxEFuse), + .instance_finalize = efuse_finalize, .class_init = efuse_class_init, }; From patchwork Tue Nov 21 17:40:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 745723 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp2014228wrt; Tue, 21 Nov 2023 09:42:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2Bv5x9t+OI9OcQxaBPeFxC5A/0q7sHERh6Q0lKDU/WJwsdldDgccRPCNCQMQ9fTJbrilt X-Received: by 2002:a05:6102:2753:b0:462:a059:4c8e with SMTP id p19-20020a056102275300b00462a0594c8emr7347931vsu.18.1700588552042; Tue, 21 Nov 2023 09:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588552; cv=none; d=google.com; s=arc-20160816; b=DexRc6jkrs30Lm1yKWFZ5CM94vM/wIKm7+TDdCvP/LLteE/1VwhEkZB2Yn2zSjVxXM 3WGBg2+1zSli1bUIIlR3Z+McAVofvSs1Bf6y9CLsYPBz4CokRGQJBLhvTfo0VYWp/sbH BFL2x9SZ5mbZFaKQdfToKchBvKGjbAezPdaOggkPTBoP4igZ99stbeSf4m1C60xnoiqM qGUZO/u6HeMbO5t1pPo5IEUrDJu5YN/EERBBZKQAj4XT+oXO80J59Bqdh060WKd04BYJ 838sfjnPokVvZJqyhQ+WECa53YKWdXWV7bTApwpoPXl3JYHmkqO/sejvIpftZHjjrYcc FgmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iW4GbGx1UKeBuWo5IN5MHnetcyTDNo6L05KNntf8yQU=; fh=cL0kZojwLp2/+GG3A9WvbPyWHrvsxnhr8acLawhZl1M=; b=khXARFcJD6O+2YKTtchYewLo3+vp63fIUxm/AA1AFn4HGp9HBHFUm7OZjKZ69CBf2i GH/jrImjJLyI0IJRl3NkZDZlMEx75ckNsATV48yhTRMC6CNHKLfp8kc1ijKXYSgZLksL wTPJs7FiMvIJ758NFpz718QRZuMUGAsuC/CJr1kC9yRO1AE1iUA+aJtsJTdspWJXClAb x6NOb0/i0RtXvWYZRHWwC5DpTf9p9QXIlPenw5hyhB//z+tKeZZKl+fGTCCYLHkaTZiS fuz2+v29Ru1mm7fduQLri4JVuDr+ujS136UjOBSN3naqiUsiU8Th+KLQMCshr+Pt7wfA KFug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NWy8vfgf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ho6-20020a056102396600b00462770c0b10si2360275vsb.204.2023.11.21.09.42.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 09:42:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NWy8vfgf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5Uka-0008Pl-Qh; Tue, 21 Nov 2023 12:41:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5UkY-0008NQ-Tf for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:26 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5UkW-0001Jc-En for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:26 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40a4848c6e1so24118945e9.1 for ; Tue, 21 Nov 2023 09:41:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700588482; x=1701193282; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iW4GbGx1UKeBuWo5IN5MHnetcyTDNo6L05KNntf8yQU=; b=NWy8vfgfZBsG0J+ip2DRxRSYOMiWo0btr/4KWGjGCod4LqmqvAdoLFPuQLCGt1KJyH LR+qo6ItxhRGYxz4FOdgHOhAYTC+KsB65DwFaoQIQtOWwQLWL9wF++OtRQbnN/3x9lJG a7hssCJSxeUoZsneG38NkkM4aVweoln6GMoe3zF3EeACmProssnz2SKUGLIZRkVm7KYo msp+Rc6U8bHSzbhD15WpwWwmKCHWLKPUKsUsAKhRbl0Kepsx31oDPUHdICT/XH/9jbKt fAKKCkMaNf0WuilBnMqK/TKIOkqAOXHrpIp6VEiMdsleX0o+924SMI7bVrZaRhDUtByd np9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700588482; x=1701193282; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iW4GbGx1UKeBuWo5IN5MHnetcyTDNo6L05KNntf8yQU=; b=wj/9LsiQk4rpuKcV2fGj8o0Ny6lo7ShpmVsLf0e2l32t6F4gh/lXU5p93jxuO/IGwl Wips1KH/BAvqSjc1EXzXefh+NWxQU2SPBEsWYxMxEXjUOXsM6qI0phUwF7xAwelpIqnU 8okMplpC9D1BsD5UR2MIaCCZUaq5jjC+/EWXIKYncQI6kK+9x/F3d42Wi59YR3nZdffT 5nk8K1Gn+9xoxYr7WLpIYWuWWyzR++sPUu+orVgRRAFhkD94+0UldCXDNKuTJNsB5qGy 83SI+dyVghV6DzsvH72KVvi3qjRy+SFuCKunj+LrvWK7N+F6nIsjVgDAsVkPbAXJ8Ewp 2dNA== X-Gm-Message-State: AOJu0Ywy7Ziryv+NGHomQisvvSpXatmtLazW8vt+GtYxJUyndzMS/hCP 59DZ+pdmeSbtxXDd1fS6bUXbQ2GCJv9kc+drdLs= X-Received: by 2002:a05:600c:5127:b0:409:79cb:1df6 with SMTP id o39-20020a05600c512700b0040979cb1df6mr44139wms.14.1700588482749; Tue, 21 Nov 2023 09:41:22 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-219.dsl.sta.abo.bbox.fr. [176.184.8.219]) by smtp.gmail.com with ESMTPSA id u3-20020a05600c00c300b0040648217f4fsm21512532wmm.39.2023.11.21.09.41.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Nov 2023 09:41:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Kevin Wolf , "Edgar E. Iglesias" , Eric Auger , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH-for-8.2? 5/6] hw/nvram/xlnx-efuse-ctrl: Free XlnxVersalEFuseCtrl[] "pg0-lock" array Date: Tue, 21 Nov 2023 18:40:50 +0100 Message-ID: <20231121174051.63038-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121174051.63038-1-philmd@linaro.org> References: <20231121174051.63038-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit 0be6bfac62 ("qdev: Implement variable length array properties") added the DEFINE_PROP_ARRAY() macro with the following comment: * It is the responsibility of the device deinit code to free the * @_arrayfield memory. Commit 9e4aa1fafe added: DEFINE_PROP_ARRAY("pg0-lock", XlnxVersalEFuseCtrl, extra_pg0_lock_n16, extra_pg0_lock_spec, qdev_prop_uint16, uint16_t), but forgot to free the 'extra_pg0_lock_spec' array. Do it in the instance_finalize() handler. Cc: qemu-stable@nongnu.org Fixes: 9e4aa1fafe ("hw/nvram: Xilinx Versal eFuse device") # v6.2.0+ Signed-off-by: Philippe Mathieu-Daudé --- hw/nvram/xlnx-versal-efuse-ctrl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/nvram/xlnx-versal-efuse-ctrl.c b/hw/nvram/xlnx-versal-efuse-ctrl.c index beb5661c35..2480af35e1 100644 --- a/hw/nvram/xlnx-versal-efuse-ctrl.c +++ b/hw/nvram/xlnx-versal-efuse-ctrl.c @@ -726,6 +726,13 @@ static void efuse_ctrl_init(Object *obj) sysbus_init_irq(sbd, &s->irq_efuse_imr); } +static void efuse_ctrl_finalize(Object *obj) +{ + XlnxVersalEFuseCtrl *s = XLNX_VERSAL_EFUSE_CTRL(obj); + + g_free(s->extra_pg0_lock_spec); +} + static const VMStateDescription vmstate_efuse_ctrl = { .name = TYPE_XLNX_VERSAL_EFUSE_CTRL, .version_id = 1, @@ -764,6 +771,7 @@ static const TypeInfo efuse_ctrl_info = { .instance_size = sizeof(XlnxVersalEFuseCtrl), .class_init = efuse_ctrl_class_init, .instance_init = efuse_ctrl_init, + .instance_finalize = efuse_ctrl_finalize, }; static void efuse_ctrl_register_types(void) From patchwork Tue Nov 21 17:40:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 745722 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp2014107wrt; Tue, 21 Nov 2023 09:42:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYO+AEvQycNt1SFr3QUvqOs36sQu5OQc8qpZP0Q0YcIPiw9OBOjodS1p7Yu8VlCy5T8yYX X-Received: by 2002:a05:620a:2455:b0:774:11fe:26fb with SMTP id h21-20020a05620a245500b0077411fe26fbmr13491027qkn.43.1700588536909; Tue, 21 Nov 2023 09:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700588536; cv=none; d=google.com; s=arc-20160816; b=FS6jCWI1OxHUTifzbW9B6k2BXSiw7RMJC/HI44NtSBBX16XiinzMgXoPPx6VYGDle5 jjRgFjH1H51l+Z10lRh/bg/yxK3cwVebsdDPOD1Oxp5MTZTub7NALa1HPww0l9/gkg0b 6Y53arHXHk3atUWyBHVjybj40Ryr6XkECRjfnYO4/tX7T8Y5H5WkVjH7ol9i49VplN0W a/IaGCajstIC04gfTlsD+v2VjmZJXkoTujD28Qno35dYAA9coUorSZ5A5sT8J+kXqiL4 SQ7S+KGrlvxAbCASOgLZEni+F8vvUg1wWwkUR4K7VuCTWADHPfVg+VtgNHYOKx01/rh7 hP7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wLvcXpQco99sa0+Z1Qj96SBcGgbn4oS7DYVe2UC+AGE=; fh=m9pdibqEaBwE4nbZ1bdBlX5QKqVA9BdvTndDUPs5mJs=; b=lr2G9JYAxBiBYKy13GhogNd3Kj2oh2/BVgOeJWfM3BJ00nKTEi6GZcfYxJxvQ5Lpr7 2q2nXNd5HdfKnOP8wngBlmmZnhFzxmJf8Uunc5iH045cxcxM8Sg8E3wTz2druPPcwEff 6mduMUJv3kKVoze8oaOuopY8KCwf9XKZk2qUx/2iCZIJwDAELKZUSL4mZJaP85fQbNan I8Dp+doq6snYr9UKkeKtLojNjPGmCrAWmcxD2LHemeuBzy/aaDx2Y7Ua+0Jpi567T/0h Eo7cMC0NCDSeRO/tW5Uv1zOpX0456cVcH/dpa0bB8MsAKQbv7z4Njf/lRvFxW6pBtJEr xlww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lN9xlfjc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pw9-20020a05620a63c900b0075ccff588e4si10003888qkn.425.2023.11.21.09.42.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 09:42:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lN9xlfjc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5Ukg-0008Uc-1G; Tue, 21 Nov 2023 12:41:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5Uke-0008Ty-MW for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:32 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5Ukc-0001Kn-4l for qemu-devel@nongnu.org; Tue, 21 Nov 2023 12:41:32 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4083f613272so31617495e9.1 for ; Tue, 21 Nov 2023 09:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700588488; x=1701193288; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wLvcXpQco99sa0+Z1Qj96SBcGgbn4oS7DYVe2UC+AGE=; b=lN9xlfjc+TqtWvYl4GApf6dvwQJ5fKLq8/U8Qh/fqepQD3cKIecXgYv9T0MzOR4rRd /qbKPF+D7/kbDdM4vULD8vXkkwa+GSxf9/R3ummYrKO9mOfSHT4HbCzhHvcGC3Nz8J2N BiHvmkztAXbBOvADszrT4ZfmGq++SKms7FadSiVG52URDskt7n/zyAWBqysadS/WfaAf d/jRn10MfZ9e7K2Q1rRxnZZShShgZGHYOJtGFlmS4T+1fkjzGHbH20zB1XZb6CRusjn9 fneXW1VpDrKeT3pABhDWEQ99s2Qg56wf6sEj6cY14QWMNKaMUP4m+pcmHhXscGQw+UBh agLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700588488; x=1701193288; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wLvcXpQco99sa0+Z1Qj96SBcGgbn4oS7DYVe2UC+AGE=; b=JC02pJhZfda6+qgKr6KQb1CAik4ocpqT4lOM9QE/LapRxpU8oH+ecZ33dM2NKIMNra L7gQKcDZi+BFOYXon4kZ0KihNqXYKHMvPcaX3ZWM3Zd20UNJFMtShRd3D9M5hC91HSSA 6z/DSjGUcbW1TNlVNRFIrvcVmE+2J+IoR1zWXSUfQp4eHqTrvoUV63suFDAgzJV77u8B tvy1etJx7kOpfSM0hgz7IIJ7+xI0n6bV9C4qRVfMWx6Ra+3Vf3eQNgG1e5YjMwYIkE2Y 3ZU9RniCi5BL9g5ca5pGXxRcfF+Sc/br4UEH8pEzYENtIFfiqDqyAXpW7mtkmOHJ3BEn 5UZg== X-Gm-Message-State: AOJu0YzkAj5vjZSrtHSH8cDKfKY9dEGPeHNOTZaWHAurREwa+2btFQnb ydGUDZEvAw6S/JzcDCSNuN+LxV/E8M1JaUmZWzQ= X-Received: by 2002:a05:600c:35c9:b0:40b:2a20:3d3 with SMTP id r9-20020a05600c35c900b0040b2a2003d3mr32186wmq.30.1700588488447; Tue, 21 Nov 2023 09:41:28 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-219.dsl.sta.abo.bbox.fr. [176.184.8.219]) by smtp.gmail.com with ESMTPSA id h18-20020a05600c351200b004063ea92492sm18045128wmq.22.2023.11.21.09.41.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Nov 2023 09:41:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Alistair Francis , Kevin Wolf , "Edgar E. Iglesias" , Eric Auger , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.2 6/6] hw/input/stellaris_gamepad: Free StellarisGamepad::keycodes[] array Date: Tue, 21 Nov 2023 18:40:51 +0100 Message-ID: <20231121174051.63038-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121174051.63038-1-philmd@linaro.org> References: <20231121174051.63038-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit 0be6bfac62 ("qdev: Implement variable length array properties") added the DEFINE_PROP_ARRAY() macro with the following comment: * It is the responsibility of the device deinit code to free the * @_arrayfield memory. Commit a75f336b97 added: DEFINE_PROP_ARRAY("keycodes", StellarisGamepad, num_buttons, keycodes, qdev_prop_uint32, uint32_t), but forgot to free the 'keycodes' array. Do it in the instance_finalize handler. Fixes: a75f336b97 ("hw/input/stellaris_input: Convert to qdev") Signed-off-by: Philippe Mathieu-Daudé --- hw/input/stellaris_gamepad.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/input/stellaris_gamepad.c b/hw/input/stellaris_gamepad.c index 06a0c0ce83..9dfa620e29 100644 --- a/hw/input/stellaris_gamepad.c +++ b/hw/input/stellaris_gamepad.c @@ -63,6 +63,13 @@ static void stellaris_gamepad_realize(DeviceState *dev, Error **errp) qemu_input_handler_register(dev, &stellaris_gamepad_handler); } +static void stellaris_gamepad_finalize(Object *obj) +{ + StellarisGamepad *s = STELLARIS_GAMEPAD(obj); + + g_free(s->keycodes); +} + static void stellaris_gamepad_reset_enter(Object *obj, ResetType type) { StellarisGamepad *s = STELLARIS_GAMEPAD(obj); @@ -92,6 +99,7 @@ static const TypeInfo stellaris_gamepad_info[] = { .name = TYPE_STELLARIS_GAMEPAD, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(StellarisGamepad), + .instance_finalize = stellaris_gamepad_finalize, .class_init = stellaris_gamepad_class_init, }, };