From patchwork Fri Jan 6 11:22:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1722371 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Sab/VeMi; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=GTXNi9RH; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NpLXq5rhXz23fn for ; Fri, 6 Jan 2023 22:22:35 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=b8/k3bE7FHL/Tk5XYXwBT1R/CH5ljmNiZdZvXJjligY=; b=Sab/VeMibZTUt7 6OuInk0+T0DppfdX8ElTvo7ufTys3NQqbb6UXjHfzPjj7gHqxSsRhHAqJPmPlgu36yfDlNZ9KWUXz amPrkLwlXJjeoTDcqyb8YuGk+vY0XTMs/emhCY39hivpt1UHGjas5rgn9LYwkczp8DsYl2w/lme9Z U/E3qoDsvJx/ibve1gS2VIui0eO5ksBWYgJAPEwbaAT7CkHdSsIH8ONP0DtTukWPz+BYD7fe1mB4k wt82BSDN95mf0H4xKZ1OqrznL6D9M/dJeCR1j2XRcZCXkOXGgIF6gjVLkiKa0TdGwqlJzDLlB7LUr Bv3XkAXCkMfCtrlo00/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDknk-007i5k-Be; Fri, 06 Jan 2023 11:22:20 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDknh-007i2l-Px for opensbi@lists.infradead.org; Fri, 06 Jan 2023 11:22:19 +0000 Received: by mail-wm1-x334.google.com with SMTP id b24-20020a05600c4a9800b003d21efdd61dso853925wmp.3 for ; Fri, 06 Jan 2023 03:22:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=IZSyslErJWgC+xyqHOu7hImqAOny20e5nC5UtJDaWrA=; b=GTXNi9RHUoFVIxfWQGF2AJC+22Ehr7njGCrKesp2zfPF0kl4m0qaNHJYF2CLhTZCDn L8s7FAy7Mg3wuSH13UL5UUkY0rdRDIbG82i+VaQ3WEh2X7V8VEUtxSX5iLhxQEgXLWPG rACuPwSaA2KN4Son1BtvjTyAZenwspQei1amed6b41RMoM6/AudPmvBbX1pWKiFXbOYV qlBw1U88u70o57jMBNmyP/v8y8aejj0O/3aSh2ZjPoELWXeH1PJVZXjoMSfvcNTLUbsa kfr5hAse0+BYqjQLE25EgFJxDHR646p/nt9CgEHxESEusoEZ3fxsSbaXOw58kmK+qJ7+ 5s6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=IZSyslErJWgC+xyqHOu7hImqAOny20e5nC5UtJDaWrA=; b=FXYCx+Z93rHsJjxrn12a1AgR7z6H779cdBRT5qv1fL5d+hUgFzKBez7XEeLLK3FXKR f3T8oN8uOFda3wdHR5pCCmR4pBkGChE5VHoSU43dG6LWdbqxxN7ytmq1480KSGSkEhJZ wrc7/gbqjEMoA8y85iuIY07ugsDNS8aJghfKluq7LGbHdEby1se+zzE8rB8O/fGs/SKs bD19Ue1zGt2qPuuOi2ylGSMP6G3KLtYq2vn4SwR/H5LJDMpd5K6ojf0DJPV2xlxzypTV WCnrULj1tg5rIzKX1lnBQvkp9EvgyGVAzSaPOb6rn8vBoZmbxocvaxUeWQ25qR1IuXeC hPfQ== X-Gm-Message-State: AFqh2kqA+p658giDjrp7pN2pRJcCAxrjFEYibxQmXHsLQSssfIequGV7 ot0oHSW/LnZZzqEdRT9rjNh+I5iVNIsE/QR8 X-Google-Smtp-Source: AMrXdXuQTTMeCQl4Qao3ZjgUDdzqReeUsRomnC1VdkXd8YcxAONr5ueCsT6836irt1NxZ97Dh0SVSQ== X-Received: by 2002:a05:600c:1d0e:b0:3cf:8957:a441 with SMTP id l14-20020a05600c1d0e00b003cf8957a441mr5289561wms.12.1673004133910; Fri, 06 Jan 2023 03:22:13 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id bg24-20020a05600c3c9800b003cfa3a12660sm14247163wmb.1.2023.01.06.03.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 03:22:13 -0800 (PST) From: Andrew Jones To: opensbi@lists.infradead.org Cc: 'Sia Jee Heng ' , 'Anup Patel ' , 'Ley Foon Tan ' , 'Atish Patra ' Subject: [RFC PATCH 02/11] lib: sbi_hsm: Don't try to restore state on failed change Date: Fri, 6 Jan 2023 12:22:00 +0100 Message-Id: <20230106112209.441825-3-ajones@ventanamicro.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230106112209.441825-1-ajones@ventanamicro.com> References: <20230106112209.441825-1-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_032217_874072_40F495D3 X-CRM114-Status: GOOD ( 10.21 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: When a state change fails there's no need to restore the original state as it remains the same. Signed-off-by: Andrew Jones --- lib/sbi/sbi_hsm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:334 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When a state change fails there's no need to restore the original state as it remains the same. Signed-off-by: Andrew Jones Reviewed-by: Anup Patel --- lib/sbi/sbi_hsm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 1896f52c2ab2..6ef6c5bdd4a7 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -429,10 +429,8 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type, /* Directly move from STARTED to SUSPENDED state */ if (!__sbi_hsm_hart_change_state(hdata, SBI_HSM_STATE_STARTED, - SBI_HSM_STATE_SUSPENDED)) { - ret = SBI_EDENIED; - goto fail_restore_state; - } + SBI_HSM_STATE_SUSPENDED)) + return SBI_EDENIED; /* Save the suspend type */ hdata->suspend_type = suspend_type; @@ -467,7 +465,6 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type, jump_warmboot(); } -fail_restore_state: /* * We might have successfully resumed from retentive suspend * or suspend failed. In both cases, we restore state of hart.