From nobody Fri Dec 19 20:54:18 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BEEADDDC; Thu, 9 Jan 2025 09:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736414142; cv=none; b=Vg2UgYh13i/hi2QfnH7lGm4N4zYJC82u5DafxM4yNLwDZsbESTmllUd4EW+o5s62G+Ek7hL5RMDepj+PaxuRu7IoiDG39ql53FHFe8+S1PCDU4iEE+O48siruecyQPb1uYB2pxrZhswG5uh2dzo3jrKkgK5kRBxLxT2yYBLRNJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736414142; c=relaxed/simple; bh=W2l65P6j3W66c1t9B6nRg4c6dRmTGz+IulnogJFIacE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=FCi3Ai5xhhTPjUI12ggNXSc7GUeIyRu158cYCo0sAyRtD9rskC//YJY94YiqaKgayKhrTkKE3y5DhD2Vl/wD8xZWFHYWCm/+ZOtXP4wg3ZE4MHlvOFgIcP0EHhoJP4uJCVJjEq0SU2EUzWl3xjHHNdH18+faKsniVXUgL2Bx4lI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Pu6fzVK/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=SjhqRw1p; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Pu6fzVK/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SjhqRw1p" Date: Thu, 09 Jan 2025 09:15:38 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1736414139; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aZrQkXL7jSmfvllp3z3CiSbWGCBJlP8vxrdqSRZXHyc=; b=Pu6fzVK/vCAWROqyuDcyqa1F7cC17AsDcfdQpuRFfjMg9EGYhnq+t9v99XC8NBOXIBjq64 us2OUkbdN1aawIogEzn97KyMKcUp1XM0MyNRbgPmDQBpmLo7bdN3o5uiIaGhaCwanhdQHR HNrQKgTlSZMeT9/D4gjkNG6TDYyoPicAn+g8tpAnVVv/487H9clgx9b9YPeZ3bSPSUC0an Cano8eBQQhTdril7qvgKewuNs5SYpDn7SqLTiP5XawV1ca0wLc+vmgsdGHGkGZMWE8MmRT JLxDjsZd4+kCLl+AZIVMG0kIW4w19e+5wwLooKIF3/wjU3+9Q0Y/WOrs/eYiwg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736414139; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aZrQkXL7jSmfvllp3z3CiSbWGCBJlP8vxrdqSRZXHyc=; b=SjhqRw1psIJexY6AzmMRMXCTUERm40cY29EO74vXnRkpeguyhsmdmARXIIc8xkcR93a1FA 1msmsGEOK0UygNDg== From: "tip-bot2 for Yazen Ghannam" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/misc] x86/amd_node: Update __amd_smn_rw() error paths Cc: Tom Lendacky , Yazen Ghannam , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20241206161210.163701-12-yazen.ghannam@amd.com> References: <20241206161210.163701-12-yazen.ghannam@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <173641413843.399.17195681483089891991.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/misc branch of tip: Commit-ID: 35df797665cb69e68a3a99e499e75e73efbd4f77 Gitweb: https://git.kernel.org/tip/35df797665cb69e68a3a99e499e75e73e= fbd4f77 Author: Yazen Ghannam AuthorDate: Fri, 06 Dec 2024 16:12:04=20 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 08 Jan 2025 11:01:46 +01:00 x86/amd_node: Update __amd_smn_rw() error paths Use guard(mutex) and convert PCI error codes to common ones. Suggested-by: Tom Lendacky Signed-off-by: Yazen Ghannam Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20241206161210.163701-12-yazen.ghannam@amd.= com --- arch/x86/kernel/amd_node.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/amd_node.c b/arch/x86/kernel/amd_node.c index 95e5ca0..0cca541 100644 --- a/arch/x86/kernel/amd_node.c +++ b/arch/x86/kernel/amd_node.c @@ -136,28 +136,24 @@ static int __amd_smn_rw(u16 node, u32 address, u32 *v= alue, bool write) int err =3D -ENODEV; =20 if (node >=3D amd_nb_num()) - goto out; + return err; =20 root =3D node_to_amd_nb(node)->root; if (!root) - goto out; + return err; =20 - mutex_lock(&smn_mutex); + guard(mutex)(&smn_mutex); =20 err =3D pci_write_config_dword(root, 0x60, address); if (err) { pr_warn("Error programming SMN address 0x%x.\n", address); - goto out_unlock; + return pcibios_err_to_errno(err); } =20 err =3D (write ? pci_write_config_dword(root, 0x64, *value) : pci_read_config_dword(root, 0x64, value)); =20 -out_unlock: - mutex_unlock(&smn_mutex); - -out: - return err; + return pcibios_err_to_errno(err); } =20 int __must_check amd_smn_read(u16 node, u32 address, u32 *value)