From patchwork Mon Feb 27 10:30:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1748593 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=e66kX5VD; 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=PbjHvxOw; 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 4PQGy34Q7sz1yWw for ; Mon, 27 Feb 2023 21:31:39 +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=x2CCDprU5hIj1l9JjAET4bDzFEya8BpHpS/nWT5xqGE=; b=e66kX5VDVYC4fm 89TpmS5xblW6s/kNIntg1lz9/voiblo6UqYKZ6e8P5oyg0q5iVeon8uxaORgeqblJI7vBzq3Ud+EO IAzduHoflmjarGIO4NBisRDgC2W9S//SnuvRr912rbT5ZFv36c+ZO8IdLARAJU4Kxud8zCZrlbXua 4fdx5gtqqXhpU2xIFFNcXOQB15MobFpDkLOYkszWUM7eM+eVaUsAoIfamCmQi6dpz3HcUbDVDyBiL 9eiYR6+vF1yv5j3GpfKbJePyVWJT91+II2WTQcghLHE4mT09zyRfPaKAmn2b2qblw4+FgJSAJEi7t AAMxLOD8NRquQjG8uSQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWamz-009EVL-18; Mon, 27 Feb 2023 10:31:25 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWamu-009ETE-Oj for opensbi@lists.infradead.org; Mon, 27 Feb 2023 10:31:22 +0000 Received: by mail-wr1-x42d.google.com with SMTP id bw19so5608965wrb.13 for ; Mon, 27 Feb 2023 02:31:18 -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=l5PNA7eCDnerEK00iHsatrtclCndJFVzJ3CruUMd+Wk=; b=PbjHvxOw5f93FI5n90BtaZU50WT+uvbe8N92GLQPxAOB6gzcWindD4n4Hya8UlUiBK 4QC7UbjTe+hAsvX3qfPFgP2FsRtulcae93+7z+ZjRIa0U9YMHADFASSJtNZNLPRngQyQ lN4OlYcgMA/LVmokCjv4IaYeBSotaLROWUux/7Br4Eo3EuDAI87ydL50a1Dxx4LBoJOV LDhFw16zszfeaFt/+4r48eNZtbJNSn2gH+XPVHLsmcvB7mB4zttKhUMiXCWQFqmdzGUX BmC8dKIuoW9kUZoLV/CZVvDkQO3Ul0tBO5/y7FcfyYS+ovHl2dnVLfaQv5oiAiKTQVsX Km9w== 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=l5PNA7eCDnerEK00iHsatrtclCndJFVzJ3CruUMd+Wk=; b=79oBqC1+TiYe7k0y//7x1vwFIbLoAxpX3LaWnYZ/POKW2vt9VmtfWPW7o4vnygppWJ C0VD6uwtQWMD2VzniMe4mWNdzoVYcIe0oTpzryF20yDZcqj6rrVbK1QPbypFYL7Tgi59 S0DEF/HVUd+vL4VUbT5hH/6zLukyR+KnYd2QZ/bJT3vjw1wkkHdU7QgaDwjyRRpUct/W gWq2vQnv49Vm0SQoWD55SSYCD2iHYA2Wwz7ZXiJD2ds8cqkjm3mmctLSa4CcFk50AId1 1Hs0vUOmTU1FNej9Tn5AFQ8iHjBN8gLr3XXKoK3gtGbB++DXOSN/YLAtx2eURjPHEZpj vEhA== X-Gm-Message-State: AO0yUKVBuulql+3i+/qhpoR/B2TQ5Zg+js00+sReekB1wTtQWI6rcSU5 6pJpBeOznVqUBQA7qg6whLj/gTjzaaKhYSnm X-Google-Smtp-Source: AK7set8B/qY5UcdUllm7IOt6u1Y8ql+WDJeje4c8gMPJVjWEQjuGJDxUrBLLSIzbFvSnGMMirX9Lhg== X-Received: by 2002:a5d:6acf:0:b0:2c7:17db:bf5a with SMTP id u15-20020a5d6acf000000b002c717dbbf5amr8609467wrw.5.1677493876734; Mon, 27 Feb 2023 02:31:16 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id u3-20020adfed43000000b002c55ec7f661sm7006449wro.5.2023.02.27.02.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 02:31:16 -0800 (PST) From: Andrew Jones To: opensbi@lists.infradead.org Cc: 'Ley Foon Tan ' , 'Atish Patra ' , 'Anup Patel ' , 'Sia Jee Heng ' , Anup Patel Subject: [PATCH v2 02/11] lib: sbi_hsm: Don't try to restore state on failed change Date: Mon, 27 Feb 2023 11:30:57 +0100 Message-Id: <20230227103106.137995-3-ajones@ventanamicro.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230227103106.137995-1-ajones@ventanamicro.com> References: <20230227103106.137995-1-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230227_023120_980586_5954D051 X-CRM114-Status: GOOD ( 10.11 ) 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 Reviewed-by: Anup Patel --- 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:42d 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 b71ee6ba4e80..7ee4159256be 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -428,10 +428,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; @@ -466,7 +464,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.