From patchwork Mon Nov 20 21:32:58 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: 745402 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1535262wrt; Mon, 20 Nov 2023 13:41:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyBxKHX5NrSCsPVo7jKaWdNGOIfynKEB2a8aXQ/1eLul+EHXYc4J7G+Cj9dq4J12krso/X X-Received: by 2002:a05:620a:6505:b0:775:9e64:f5be with SMTP id qb5-20020a05620a650500b007759e64f5bemr11313659qkn.55.1700516518376; Mon, 20 Nov 2023 13:41:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700516518; cv=none; d=google.com; s=arc-20160816; b=X30sPDLq3O5re+sOkeYNcx+yeu2d9FLF7EpMNPW9ZzW2h7VuNbGBey7DeuD+Haale5 Du6n6VZqTIIYtzdz4LckAb0rLdh4nKZZ9p93tp2oUSU8Bccn46UDkIrLxijhtGEiVguX dWA3oYeYzc52XXaaU6kot63q8/Bh3+UELqYZFZhufHQe9JAnOt+6rzrfkm/QojWCiFZ3 czVX55TIVk0lyO7aV9BDSYPxPTTfuw/pYzqotaieutoP0MaOmz6ajThm0RbSWhzdSRuE TsXSwxrUuCzOLbqs5c+iVy8IELlI1uak/dVM1/RYeeH6GMLzOlA3Ry6FxWQ179XPSZv2 47bA== 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=drwtQoQ75QuwOSsjQYja6ApK0ZWyT5mWD40njjZhqyI=; fh=AVTfbHsPJGg1WFQV1X+Bul2rECWTr55QornV8gS+Ss0=; b=jakEOezG0uGh9beGp/sVy7f64ElMWESoB1biW8MBlofKF5bewof4QTElSC0hGs5cg0 g612gAc3dQrKycA+szOc5paVXd1iMpWi/yUU5+vzeAa7gAah6yT2fDbYAOkG+ga5WlZY qPs/4aNNsVm9OZOBPIILq9uHbO9r+Fo8BHjeU9YPcQRvc9wSKA4p5wxej/OXSTEXUSqz YoZxs/3ayGYYHzDbhoAXK4xVOOnvIkQJcP3WDzw0SvE+Gt/gPX8fbWmwoeKJ+Sd8joVj iww0oKWUlnJCc3OWgQexlYFi4GbARoJOe+aN+IkWJ26bSdZXQlYSB0hgPRA5bXSN5ZFp ZlFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OCPuesFL; 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 bm14-20020a05620a198e00b007740f1c2b49si8323619qkb.328.2023.11.20.13.41.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 13:41:58 -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=OCPuesFL; 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 1r5BzD-0004Vo-5I; Mon, 20 Nov 2023 16:39:19 -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 1r5BzB-0004Px-Qh for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:39:17 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5Bz9-0004iZ-5I for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:39:17 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32ddfb38c02so3233970f8f.3 for ; Mon, 20 Nov 2023 13:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700516353; x=1701121153; 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=drwtQoQ75QuwOSsjQYja6ApK0ZWyT5mWD40njjZhqyI=; b=OCPuesFLnTny55vzGzN+ysvm91sZbnROQwfte0JO5Gk66U7AKVXMKdtwt7N/OmkFys cv3pDJEiO/Y3u/ODWVguBZMdXICZHB8Gsl1V37ecb5anAE88UAcJoz45fODwVqBVqyu8 roMUyJ8vEZWJqHAi0UzqGwOQeRdUgGNL4RSOwoZ7rBMafuaespdfEehdZaTOcu0llogk iH9fSkyDBcKfjH9Xc15/AjTn2muCysSPwlaWnKLluoxinrfzRhcM8Qy0cPGE+ule24S6 1Z9oPYqK6ZwQnIdUPzWhOSPFFT/rZN1Rls4pQ+48xnkPJ5+KVd1igulUJdCc9DBAlrNi IIZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700516353; x=1701121153; 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=drwtQoQ75QuwOSsjQYja6ApK0ZWyT5mWD40njjZhqyI=; b=hVYEnA+N0Xq1wEHmW+1JFa5tVArRlmQEUeHIP95nMvKgxhYiLrcWJqekW3/xMlbOp3 ubaZq7SBc8U3cOwn7YJFh7VSP9N6otrnEK7YMH1PF6VIsRK8vPcqLHWxXnwRR+xS7YVW 0olmh5X2sNHPK7bxQ/s5Pj/Km803hTFF7SDokAxkb/j+Ex9Nkke8qxojdkEbsYJfonZk fa5TM0Z2jzgOAi5wKARr3APkDJ0pv/OBOYQn86IyQ5VffKRa253ge8FZlBqFDPU3apeC Hxiu9hAAgQU7FHEhTo27gGq7KvdexYNyENymWWjjSOn4cfjvUZ0/KNF3+ZuUbrPdPMQ1 2L9A== X-Gm-Message-State: AOJu0Ywnyb11iKOsqRLHQduXdPYomCXTZaCPagmeKE10AmpDaFHPc6hY O1KPfz3HYCwzOIIO80fpsWcHxvD5PTEi3pyA9p0= X-Received: by 2002:a05:6000:18ad:b0:32d:b06c:d30b with SMTP id b13-20020a05600018ad00b0032db06cd30bmr6850326wri.55.1700516353594; Mon, 20 Nov 2023 13:39:13 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.190]) by smtp.gmail.com with ESMTPSA id r12-20020adfda4c000000b003232380ffd7sm12279698wrl.102.2023.11.20.13.39.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Nov 2023 13:39:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Peter Maydell , "Michael S. Tsirkin" , qemu-arm@nongnu.org, Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , Igor Mammedov , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9?= =?utf-8?q?dric_Le_Goater?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Xu , Joel Stanley Subject: [PATCH-for-9.0 24/25] hw/nvram: Simplify memory_region_init_rom_device() calls Date: Mon, 20 Nov 2023 22:32:58 +0100 Message-ID: <20231120213301.24349-25-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231120213301.24349-1-philmd@linaro.org> References: <20231120213301.24349-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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 Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, arg5, arg6, errp; @@ - memory_region_init_rom_device(mr, owner, arg3, arg4, arg5, arg6, &errp); if ( - errp + !memory_region_init_rom_device(mr, owner, arg3, arg4, arg5, arg6, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan --- hw/nvram/nrf51_nvm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/nvram/nrf51_nvm.c b/hw/nvram/nrf51_nvm.c index 7f1db8c423..7b25becd49 100644 --- a/hw/nvram/nrf51_nvm.c +++ b/hw/nvram/nrf51_nvm.c @@ -336,12 +336,9 @@ static void nrf51_nvm_init(Object *obj) static void nrf51_nvm_realize(DeviceState *dev, Error **errp) { NRF51NVMState *s = NRF51_NVM(dev); - Error *err = NULL; - memory_region_init_rom_device(&s->flash, OBJECT(dev), &flash_ops, s, - "nrf51_soc.flash", s->flash_size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom_device(&s->flash, OBJECT(dev), &flash_ops, s, + "nrf51_soc.flash", s->flash_size, errp)) { return; }