From nobody Wed Nov 12 07:09:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568646526; cv=none; d=zoho.com; s=zohoarc; b=Kbhgl5NVGYpiGxUDWwtpsdHPVYFbhcU4QMJl6LpSg0ueg8VaIevNDd6fC8ARtfYi/OrmsJeJ1crSXK5CvvDR3zSEctMB/Ep4T1omyt+V8oPcr/EBIYX2Q/45VlbP1kdz6qDLwuphbQfofPdwI34l2MQMlmBFKR7COyCZGf+UDFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568646526; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mE/BuqEE8gv/JobfMAiia0z3Ltz3qiUZMeH9v73HiNI=; b=ZjUfp4ovYUiTElRrkJASH7f5V1wVJ0GCvpmFZL/BJM9pwWLZEDYHUoLjEJ6OzPJsxPpD55RA+d/+ns2+oIVNS5ASEYBH80Ksg8lQJZZD0B6XeHmerebVMwGXKyeAhHGObnR0W6pQY9HutPNU/mt/HFlOlsEcA5XFCu5jmspf8iI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1568646526392662.1675042070144; Mon, 16 Sep 2019 08:08:46 -0700 (PDT) Received: from localhost ([::1]:35698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9scO-00078Y-H1 for importer@patchew.org; Mon, 16 Sep 2019 11:08:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53597) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9sCo-0006Jb-Fk for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:42:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9sCm-0007Q5-Df for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:42:18 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:52184) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i9sCm-0007Ph-17 for qemu-devel@nongnu.org; Mon, 16 Sep 2019 10:42:16 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 7so80693wme.1 for ; Mon, 16 Sep 2019 07:42:15 -0700 (PDT) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id i14sm17024298wra.78.2019.09.16.07.42.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Sep 2019 07:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=mE/BuqEE8gv/JobfMAiia0z3Ltz3qiUZMeH9v73HiNI=; b=duaHcljHBMDeBPj8+dxOx69c5+tMT1BrLsxK18JJKUDoeLkIACjQzFnNM30SlCvHuQ BS/lex4pHFOJi+OPj8QHNxyni8UOCKMghX/hDSXog90hAylo7uzJW17OKpst5Bw7iDHS hZnBQVWbQSP7c+wNXKmdGNoySGRDH1sjiYfC49mmB5ZRVFRqFHGuCo2h/mXuTWIMYOYA WEzhHDqIGXYch1JN3MHMLWJ7UTWNNUS2n+dNiEPO7nBeHLD6Ye8JZbRIy0ylJigJHkS3 UHPIPWzjDOgong05a60znkUlVCWKHNsVoEod5pUtqa9wrrlteZqJmlj/7vIAqpkhj8VQ 0hHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=mE/BuqEE8gv/JobfMAiia0z3Ltz3qiUZMeH9v73HiNI=; b=tObuyt3yjlrfOSm/a7BbckssOlzXkm3PyrP6uHdVyVNSVPT8SP8dhCAnVenqiS/Afv M6ZR4zs9iLNSD7v9beB4YLCNs/ZzD3D73FGLForhJoC6D+AwnuiqK+rJXQhjestvYMnU M/qFnbGN+JQw4tL2L7psE/6eIQ8Gtnfn144d9H+s6+OPVcDBnrQqLwF/kOCvXUSkjR5o /Nex/1xeDGWwI+7P9LaClGbvLaWtCC2FrgfUoPfTtQ+/Oq4FAKgkhlwvCnxarlCJWnsM JSttt7KGCQtcm2ZKm0SodkMxeu++NCnBohZwXN5ZzNEdd0WnVviprc5Ki0R8H4Jp8gBq G5dw== X-Gm-Message-State: APjAAAX/BOv7Stm6xDtRVY6fslmUmsNyz/yrA06b3PlOTdg/MrTpqfFl jMSvDXQADVMZs91SzkEBTvQg7i8x X-Google-Smtp-Source: APXvYqyZNgif8Elheu7kUKrwItLHC7HqeMIbhaqH2FZTgsimIA2VrI7LugzlDBgBdDnvBdA5Hca5Rw== X-Received: by 2002:a1c:a404:: with SMTP id n4mr37094wme.41.1568644934721; Mon, 16 Sep 2019 07:42:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 16 Sep 2019 16:41:44 +0200 Message-Id: <1568644929-9124-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568644929-9124-1-git-send-email-pbonzini@redhat.com> References: <1568644929-9124-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f Subject: [Qemu-devel] [PULL 04/29] exec.c: subpage->sub_section is already initialized to 0 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: Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Wei Yang In subpage_init(), we will set subpage->sub_section to PHYS_SECTION_UNASSIGNED by subpage_register. Since PHYS_SECTION_UNASSIGNED is defined to be 0, and we allocate subpage with g_malloc0, this means subpage->sub_section is already initialized to 0. This patch removes the redundant setup for a new subpage and also fix the code style. Signed-off-by: Wei Yang Message-Id: <20190321082555.21118-5-richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini --- exec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index ff3cb3e..d9827ef 100644 --- a/exec.c +++ b/exec.c @@ -1491,8 +1491,8 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu, =20 #if !defined(CONFIG_USER_ONLY) =20 -static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, - uint16_t section); +static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end, + uint16_t section); static subpage_t *subpage_init(FlatView *fv, hwaddr base); =20 static void *(*phys_mem_alloc)(size_t size, uint64_t *align, bool shared) = =3D @@ -2913,8 +2913,8 @@ static const MemoryRegionOps subpage_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, - uint16_t section) +static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end, + uint16_t section) { int idx, eidx; =20 @@ -2937,6 +2937,7 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr b= ase) { subpage_t *mmio; =20 + /* mmio->sub_section is set to PHYS_SECTION_UNASSIGNED with g_malloc0 = */ mmio =3D g_malloc0(sizeof(subpage_t) + TARGET_PAGE_SIZE * sizeof(uint1= 6_t)); mmio->fv =3D fv; mmio->base =3D base; @@ -2947,7 +2948,6 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr b= ase) printf("%s: %p base " TARGET_FMT_plx " len %08x\n", __func__, mmio, base, TARGET_PAGE_SIZE); #endif - subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, PHYS_SECTION_UNASSIGNED); =20 return mmio; } --=20 1.8.3.1