Received: by 2002:a17:906:43c7:b0:78d:9f02:16a1 with SMTP id j7csp2696064ejn; Mon, 17 Oct 2022 14:49:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/hTk9MvdTAfCW7pyZMWX8KpyhsLZymjXszZz/Rw+FC69zBcsCfC7OxPuY4IpTe1KQrcqH X-Received: by 2002:a05:6214:2682:b0:4b4:8c75:2488 with SMTP id gm2-20020a056214268200b004b48c752488mr10311248qvb.88.1666043355907; Mon, 17 Oct 2022 14:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666043355; cv=none; d=google.com; s=arc-20160816; b=zkAMU54myvgbluHmH8mQWWH1Z5zfCb5GVQTKi6w9BJ6qGLGSGRENuJc4dJqBSJsq+k 06das4NVEg008VmaIRVRBmRgFQapnNt3F2UdyKj9dKf8FjTlH2GvcJxdbRe4hUjZ/B2/ /clE0NgVcf8QTezqQFSlEHBf+ABiBr4b/SXH+IhqMGHCAvuqLWFg+wopBKfj92s7PlbM jxJKSyEPmcQkTsaunAAKTEF8ptT0JSHZvdQy19wyrX7ThY8yg+CdbGbprMCnpfaAsVzU 1tdebk6EwXU2ICfC2cdp+No1tuy2cKwEtpLinhCch4ZT95H8Oj6zP2KFQJHTgogWGgef AFhw== 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:message-id:references:in-reply-to:subject:cc:to:from :date:dkim-signature; bh=Lj2hjfi+qEWthqi90w1/8TzVCIrOK/VPgaAEWIVRqxE=; b=xK9Tiv7WYpdpvC7se3XSZioyE4GtX2REsPRxVCX89+9ZcAX005yA9RtVqb8ktULFNK pkHI670m9aUvkZ4eDiudaMk7YUoaXJQwLSzgF5cZevCesedcWSxE5bxFc/U4grgQBECt rauGJk4UQ/VHnhTbtA+Q0unKMaFqrW8H01VoJFcWN/ZYOhIAFgnISBuoYao1DToxnHQl nV7mWXlBUtTlHUG3+N9sbpO7k9qkFfAdqwkHMhzDMzLW3GXU6FRZpskw3uz5KdwKk4oK XYQBzyrHbDgADEbw7Vmkp4g4+6ipqehYZ043WJfCpwbboOgO7taQaX5capi4dnNGMSnR bvbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QOoNh2YE; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r12-20020a056214212c00b004b49b6d1204si6668309qvc.239.2022.10.17.14.49.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Oct 2022 14:49:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=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=@gmail.com header.s=20210112 header.b=QOoNh2YE; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1]:44288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okXz1-0007R6-Es for alex.bennee@linaro.org; Mon, 17 Oct 2022 17:49:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okXye-0007QX-F6; Mon, 17 Oct 2022 17:48:52 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:42819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okXyc-0008JL-TL; Mon, 17 Oct 2022 17:48:52 -0400 Received: by mail-ej1-x62b.google.com with SMTP id y14so27951127ejd.9; Mon, 17 Oct 2022 14:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Lj2hjfi+qEWthqi90w1/8TzVCIrOK/VPgaAEWIVRqxE=; b=QOoNh2YEc48XbC+oeO7B2MhwXqTU+Q6cdABra2WGfx9yDq7DFnOgH72cGYs34DCpRJ dDO8+O6gSSbEU4y5+jhALFxCbBULTuGPy8r1PH0Als7co8efQcHgTcvXkzNLBgEEiwcZ FAOMZJ2nYpVTXbtwbYuSYSt9/F3ypXa/bP7fQ8ATSmT4Dl2M62eGd7DPaT3cbeG9g8HT 2P7nSRnO8SPFs4kEwIuz+J00rznFCTarCLAFCYbSjwLv9pslhU/BHrh1U9pdrzJGPhWO andDY9oaL8LMxdoHrtfO5Xh5L2OI8VVv4UhktSSvw4/zCoL/2ShNMV/vRLbPd4re/FCZ gG2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lj2hjfi+qEWthqi90w1/8TzVCIrOK/VPgaAEWIVRqxE=; b=BeF2bPEpXttrzBVOSJOqWd7vkFhXBx4E2WnW3CdKzk8+3ZLMzAzQzSr8bvXDII9nFp OSXxzIBCpLRY5okdTpputi/0HxtOJHc3IdIPRnZToQPB+DvixUVxL9QsINEEhH5uc2H6 o2oqXhl4A9MvjjVddm+u3Q7eN+l4ldLNxb6UyrJ7heerrdQd+nf93oXqUhFnvHHSMjsU ZW2hAX+weBCeX9someLVSW6Us7ZAEEzkvKUwezcSzC/QOp4U/KvsD4QQLBfHsNer1Bvx 06qTpKLUoyX6un0sqGzKIUOlaPOCq4syS1j3Ze0LiHvrf3/mCBAF6NOHPyK7yJ573iql QXZQ== X-Gm-Message-State: ACrzQf1t+YB0z+1iXluH4v5w+1AgWsuF93m5jMXgZjyo3kmibMgx5Fo1 w9YwR+hj2Jz9QrxQtPFhpOk= X-Received: by 2002:a17:907:16a7:b0:78d:f586:e446 with SMTP id hc39-20020a17090716a700b0078df586e446mr10327902ejc.252.1666043327833; Mon, 17 Oct 2022 14:48:47 -0700 (PDT) Received: from [127.0.0.1] (dynamic-089-012-049-224.89.12.pool.telefonica.de. [89.12.49.224]) by smtp.gmail.com with ESMTPSA id kv25-20020a17090778d900b0078cf8a743d6sm6636940ejc.100.2022.10.17.14.48.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Oct 2022 14:48:47 -0700 (PDT) Date: Mon, 17 Oct 2022 21:48:41 +0000 From: Bernhard Beschow To: =?ISO-8859-1?Q?Philippe_Mathieu-Daud=E9?= , qemu-devel@nongnu.org CC: Peter Maydell , qemu-arm@nongnu.org, Alistair Francis , Jan Kiszka , Magnus Damm , "Edgar E. Iglesias" , Kevin Wolf , qemu-block@nongnu.org, Bin Meng , Aurelien Jarno , qemu-ppc@nongnu.org, BALATON Zoltan , Yoshinori Sato , Antony Pavlov , Hanna Reitz Subject: Re: [PATCH v3 2/9] hw/{arm,ppc}: Resolve unreachable code In-Reply-To: References: <20221016122737.93755-1-shentey@gmail.com> <20221016122737.93755-3-shentey@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=shentey@gmail.com; helo=mail-ej1-x62b.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, FREEMAIL_FROM=0.001, 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-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: sefajRrNrSHj Am 17=2E Oktober 2022 20:57:06 UTC schrieb "Philippe Mathieu-Daud=C3=A9" : >On 16/10/22 14:27, Bernhard Beschow wrote: >> pflash_cfi01_register() always returns with a non-NULL pointer (otherwi= se >> it would crash internally)=2E Therefore, the bodies of the if-statement= s >> are unreachable=2E > >This is true, pflash_cfi0X_register() use an hardcoded &error_fatal=2E > >Shouldn't it be better to pass an Error* argument? You mean that the callers would pass &error_fatal instead, including the o= nes in this patch? > >>From the pflash API perspective I don't see much value in >returning a PFlashCFI0X type instead of a simple DeviceState >(but this is another story=2E=2E=2E)=2E It comes in handy in the following patches when retrieving the memory regi= on for memory_region_add_subregion() using pflash_cfi0X_get_memory()=2E Wha= t do you think about these next patches? Furthermore, returning PFlashCFI0X can be downcasted which seems safer tha= n upcasting from DeviceState=2E Best regards, Bernhard > >> Signed-off-by: Bernhard Beschow >> --- >> hw/arm/gumstix=2Ec | 18 ++++++------------ >> hw/arm/mainstone=2Ec | 13 +++++-------- >> hw/arm/omap_sx1=2Ec | 22 ++++++++-------------- >> hw/arm/versatilepb=2Ec | 6 ++---- >> hw/arm/z2=2Ec | 9 +++------ >> hw/ppc/sam460ex=2Ec | 12 ++++-------- >> 6 files changed, 28 insertions(+), 52 deletions(-)