Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Borislav Petkov <bp@alien8.de>, James Morse <james.morse@arm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Robert Richter <rric@kernel.org>, Tony Luck <tony.luck@intel.com>,
	Yazen Ghannam <yazen.ghannam@amd.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	cocci@inria.fr, Muralidhara M K <muralidhara.mk@amd.com>
Subject: [cocci] [PATCH 7/7] EDAC/amd64: Move an assignment for the variable “F3” in probe_one_instance()
Date: Mon, 25 Dec 2023 18:46:22 +0100	[thread overview]
Message-ID: <15936ac5-5380-42fa-b13a-e6b2ccf92490@web.de> (raw)
In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 25 Dec 2023 17:54:33 +0100

Move one assignment for a local variable so that its setting will only
be performed immediately before this pointer is used.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/edac/amd64_edac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 698cde573847..91e0abdf762f 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -4263,7 +4263,7 @@ static bool instance_has_memory(struct amd64_pvt *pvt)

 static int probe_one_instance(unsigned int nid)
 {
-	struct pci_dev *F3 = node_to_amd_nb(nid)->misc;
+	struct pci_dev *F3;
 	struct amd64_pvt *pvt;
 	struct ecc_settings *s;
 	int ret;
@@ -4281,6 +4281,7 @@ static int probe_one_instance(unsigned int nid)
 	}

 	pvt->mc_node_id	= nid;
+	F3 = node_to_amd_nb(nid)->misc;
 	pvt->F3 = F3;

 	ret = per_family_init(pvt);
--
2.43.0


      parent reply	other threads:[~2023-12-25 17:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-25 17:32 [cocci] [PATCH 0/7] EDAC/amd64: Adjustments for two function implementations Markus Elfring
2023-12-25 17:34 ` [cocci] [PATCH 1/7] EDAC/amd64: Improve error handling in amd64_edac_init() Markus Elfring
2023-12-25 17:36 ` [cocci] [PATCH 2/7] EDAC/amd64: Delete an unnecessary variable initialisation " Markus Elfring
2023-12-25 17:38 ` [cocci] [PATCH 3/7] EDAC/amd64: Merge two if statements into one " Markus Elfring
2023-12-25 17:40 ` [cocci] [PATCH 4/7] EDAC/amd64: Adjust error handling in probe_one_instance() Markus Elfring
2023-12-25 17:42 ` [cocci] [PATCH 5/7] EDAC/amd64: Improve two size determinations " Markus Elfring
2023-12-25 17:44 ` [cocci] [PATCH 6/7] EDAC/amd64: Delete an unnecessary variable initialisation " Markus Elfring
2023-12-25 17:46 ` Markus Elfring [this message]

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=15936ac5-5380-42fa-b13a-e6b2ccf92490@web.de \
    --to=markus.elfring@web.de \
    --cc=bp@alien8.de \
    --cc=cocci@inria.fr \
    --cc=james.morse@arm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=muralidhara.mk@amd.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).