public inbox for linux-edac@vger.kernel.org
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: yazen.ghannam@amd.com, bp@alien8.de, tony.luck@intel.com,
	james.morse@arm.com, mchehab@kernel.org, rric@kernel.org
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tom Rix <trix@redhat.com>
Subject: [PATCH] EDAC/amd64: remove unneeded call to reserve_mc_sibling_devs()
Date: Mon, 13 Feb 2023 11:15:10 -0800	[thread overview]
Message-ID: <20230213191510.2237360-1-trix@redhat.com> (raw)

cpp_check reports
drivers/edac/amd64_edac.c:3943:37: error: Uninitialized variable: pci_id1 [uninitvar]
 ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
                                    ^
drivers/edac/amd64_edac.c:3943:46: error: Uninitialized variable: pci_id2 [uninitvar]
 ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
                                             ^
The call to reserve_mc_sibling_devs() will not fail because
  if (pvt->umc)
    return 0;

reserve_mc_sibling_devs() is only called by hw_info_get() and pvt->umc is only set
in hw_info_get(), so with fam >= 0x17, the call to reserver_mc_siblings will
just return, so the call the call is not needed.  And when that call is moved
the check for umc is not needed.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/edac/amd64_edac.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 1c4bef1cdf28..f6d50561c106 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -3179,9 +3179,6 @@ static void decode_umc_error(int node_id, struct mce *m)
 static int
 reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2)
 {
-	if (pvt->umc)
-		return 0;
-
 	/* Reserve the ADDRESS MAP Device */
 	pvt->F1 = pci_get_related_function(pvt->F3->vendor, pci_id1, pvt->F3);
 	if (!pvt->F1) {
@@ -3938,11 +3935,11 @@ static int hw_info_get(struct amd64_pvt *pvt)
 	} else {
 		pci_id1 = fam_type->f1_id;
 		pci_id2 = fam_type->f2_id;
-	}
 
-	ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
-	if (ret)
-		return ret;
+		ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
+		if (ret)
+			return ret;
+	}
 
 	read_mc_regs(pvt);
 
-- 
2.26.3


             reply	other threads:[~2023-02-13 19:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 19:15 Tom Rix [this message]
2023-02-13 20:12 ` [PATCH] EDAC/amd64: remove unneeded call to reserve_mc_sibling_devs() Yazen Ghannam
2023-02-13 20:23   ` Borislav Petkov
2023-02-13 20:28     ` Nathan Chancellor
2023-02-13 21:17       ` Tom Rix
2023-02-13 22:11         ` Yazen Ghannam
2023-02-13 22:16           ` Nathan Chancellor
2023-02-14  9:55             ` [PATCH] EDAC/amd64: Shut up an -Werror,-Wsometimes-uninitialized clang false positive Borislav Petkov
2023-02-14 14:32               ` Nathan Chancellor
2023-02-14 15:04                 ` Yazen Ghannam
2023-02-14 16:27                   ` Nathan Chancellor
2023-02-14 16:38                 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230213191510.2237360-1-trix@redhat.com \
    --to=trix@redhat.com \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rric@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox