From patchwork Mon Dec 25 17:34:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13504716 Received: from mout.web.de (mout.web.de [217.72.192.78]) (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 8BC2952F6C; Mon, 25 Dec 2023 17:35:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="br0QXRIg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703525670; x=1704130470; i=markus.elfring@web.de; bh=j6FHLbZ6EBvMZbptdGfZ3V+AeSOWsmTN5Ko7ce58BaI=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=br0QXRIgnHm+0r/fqNOkmZ7dy4gxmFHao4MJzm3oslO0OBWqyM3/h5+Wfy756MDA 1v5FB3rys0J51CiqbzvSJrkuQJSyJe2SgCkmvWfyx2wgSTX8P86cSv0QW+kneR5X7 tyoI41CZHNJ8Cfio3NqbyirM/71FMHMnErqmmuB+lizmzKpIgmG8cQa+O5DO+e2GR jsjZ+d5S8qnMaSWXo4Bfmqi3FsAVNAexCYXhgS6/9bvM6l3pL30GXgMLpyvPUlMM6 giwU63TqA9DubTNppfdmWnFencNMU9QYMBAuPGLl27R8T4LGNnzJPzuCIME5QUXqf IGeKUlUC9NwqZsZTIQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mq184-1qwBTI1nKU-00n33M; Mon, 25 Dec 2023 18:34:30 +0100 Message-ID: <4bc19468-2d48-44cd-aaad-610e720c5449@web.de> Date: Mon, 25 Dec 2023 18:34:29 +0100 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/7] EDAC/amd64: Improve error handling in amd64_edac_init() Content-Language: en-GB From: Markus Elfring To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org, Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , Tony Luck , Yazen Ghannam Cc: LKML , cocci@inria.fr, Muralidhara M K References: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> X-Provags-ID: V03:K1:sjToRHI4MMrjyzP45y6E1rvyjbGx5h7TCYxL4k4HHDpRGp6hR+B obPNhszGYCl8HdYPTLgIC2eip8304vmkOHjWrM+y66oi7vOSmkcKbOnQceOyOca4TlLoR0M KJB1oKzmiXyltmG+r6PMdGPZ+MWdtiIwp9yjMK2tnfiw8jn2h6UhwqEfhbewzao5qq/kSV0 jtISuwg5a+IMRRFZMhUSA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:CAEdyWEwjxs=;rAgHst3BMb6WjDycZy1UlGDdP7Q zvvGi/EraHs9IuktZ9RFGzVycUW2MvMey342NXF78Naoo4icMGF2mEwnKxG7RuOwscsUJLKtN ddyUkDipHnYF2rAZdAP60OQZF/8b53LR4NMrmTCXP26EFxvEt1BduXPdjWg8q/ftceIeJ2XsY nMCM6s3jcv7OnmnoEQ8dsb0ZLfsKLbfaeqELe94Y3SvU0ikVux58h6cpCjK3CmsqL5fpmcVVn zoWi3KScJNd3Rqjvv0yYFWEAgeVEgWvhdR/1MFmWZbkKJKMoi1h0sX/xKcimKlhulk7OoUAxd wkcaTKGLWcFg7S/W93f4eRThASos3ypu3KLkPfdt0irBmQHa7VPT8QLtF+JK+fWDpNwbuf/R+ 0iShsbmBE2evzjB5iDsnvUzrlp2pVWKSPQ5QO636sr33d+kYAwuqtcMQqnEo/Qfko810Nm7/q kp1iqRyHLy4QRcNRWq3Lz5aWFTVyv1Yn+aNiJ4AHZGW1GX7WGP8Nm0F9Q91gHPgolUlRHUepX wwk5YhW1UVg45TQy0Nw3ErLNaI5QOHhR8usq8Fmva0OD5ECuo5exF7an4k1OJWPF0yFBBsRA0 UzbCc8vSqM3fm+8iui2oQWfl79AbEF6YViRMuHnwEPeJUBSsvcvL9Ev03tThl7iWhijC/qZ1R pVPrwpPwXf1LFLqbInz4kAU4mKvvXBj6VarV2ABurX28cU2yPTJMKlz+bedgstn5NZvmExskN CdB/BeD9KbNl8KWVYr7vIMpoKL4KFQztKNk81348BNM7hKg6TkXx35cdxxo1hr4nN6LWw2srF m5jb/F9VsrfJfe75Xc9SjDJs56ZPhOPLbApb0AhDPNrP4FOEWtfFvw3XstM32Sh7h6AZ8B31N oOR/JGBUL7J0U3/wlW0StS4FrwQOc0YG4HA8EEdVEDyhhe0l+U0/SpNu3jYavCZzIWVlqR32d W8lijQ== From: Markus Elfring Date: Mon, 25 Dec 2023 16:21:34 +0100 The kfree() function was called in one case by the amd64_edac_init() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software. 1. Return directly after a call of the function “kcalloc” failed. 2. Move an error code assignment into an if branch. Signed-off-by: Markus Elfring --- drivers/edac/amd64_edac.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.43.0 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 537b9987a431..f912cbadefa4 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4414,14 +4414,15 @@ static int __init amd64_edac_init(void) opstate_init(); - err = -ENOMEM; ecc_stngs = kcalloc(amd_nb_num(), sizeof(ecc_stngs[0]), GFP_KERNEL); if (!ecc_stngs) - goto err_free; + return -ENOMEM; msrs = msrs_alloc(); - if (!msrs) + if (!msrs) { + err = -ENOMEM; goto err_free; + } for (i = 0; i < amd_nb_num(); i++) { err = probe_one_instance(i); From patchwork Mon Dec 25 17:36:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13504717 Received: from mout.web.de (mout.web.de [212.227.17.11]) (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 0B7E2524CB; Mon, 25 Dec 2023 17:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="r32ESMkz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703525780; x=1704130580; i=markus.elfring@web.de; bh=6YbgzX4IlCp5KaOe1RjzChWQs5gtWK+ZeLnQ6EfDZlc=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=r32ESMkzGobCaa+TbXSVG8ctXjGd5HH5sZKeKPmp6YZK9Vw2Wp0MQHkwKI3TDsNt 7IBNMJLrbOIalQcTJPrbEqbDv9QxZR5lQSsVvD5dZN4MSZ+WFZxBjkVhh5AmNiphP 0U+6K/aM2e0VPZqo2NRrusfowrLH7dcB8SJDct12W8oVi4zgurjRFi8HFoXzUrq1u wCg9e7D1umq9PmvcHnsaDuLv7UH5ad9srjeIOAwYcbCzCkEHlnVruzwZ7O3yHVrCW 9bndfhVeph5PcmClXTKu/cWNtOghOXHbscnMXGAaln4GuuUidfSGtVVF1poBIhx+7 p/qudgR5k1aYJEEpXw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MPKFD-1rcTt31g33-00PlHa; Mon, 25 Dec 2023 18:36:20 +0100 Message-ID: Date: Mon, 25 Dec 2023 18:36:19 +0100 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/7] EDAC/amd64: Delete an unnecessary variable initialisation in amd64_edac_init() Content-Language: en-GB From: Markus Elfring To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org, Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , Tony Luck , Yazen Ghannam Cc: LKML , cocci@inria.fr, Muralidhara M K References: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> X-Provags-ID: V03:K1:Cwcco78JixBvWs3sejkpE1/Op33Uc5UEd2qPxoLTasMwqfRd/u+ 2Xe//62EaQWi/BGoga/Kf5B4juLF8Qja7neUpiUujsEqDaCDy3coL6clkDyV9/B96K8ipf6 jHjPHn2JWPbTtFF1gE9lp+S3nzb47GmCCZAPyYQZDEdBRimYdI8j8uKnnfTfzMeK8Gjn7Fo TpIUegBgedkf08+kfVryg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:KkYp2qCitf4=;2S7BX8fX6dNziIhWeaAu3J7ZMNO LvgHHGbUyT8spp1asXU8Dw0TJ/cd5uIM0cNisH4OvLet2BHItSg2egbsP9/0l/S4mtTQfrwpy qLEmImBwSJKw9bGcBFu9wYTHwG4FQTH8WjfJo8GKQXAQ+y/+Ebv10zc/3qO2K3qd7WOK4ikkj UQ8S8tO6XYjrMNNwvJWeL7ZkHQEjW8fMHewEJZkt/MjVYY75bfh2a40gi1hlPoiLdiTTKHbYn YhQB4FUHPHis10bZK713fqA8tY4hRY92fnUiWhtjXHAl2eckyGji+kLTGbBK/G97YofQIT0f4 FzChciIrpGT3erPLBYe8f2nkEvb/nvltQ8nPF6FTEF/37WJTdFgT7Vfw2/r7UFx6sUy1iwr4i 8T8HXhRgB/cCeyjqjss0ppeX2qsH9J8K2l5NiqAMvyM2rs5wauw9M61Ne5xpUwkL1n2+fOI8J ql042PMK06KBEJkND8/ju7Bpj2W9OI2ArYiQ3NCYLo4l6+g/A9VHnYLTbq2avlCtX7wS8bpCH EoNhMogMInwWuFqlEfNcxl4OMV09ktcSAq6GYDezhFFs+TZPXp9o51asbY02nVviDs55pCCTf 4FP8QFd/WgzNnWBA6xhFdgMrH9absOWATDeRBXmlZEHxzqnc2k/u+W+85GWk+fwS5rAsQBDUo Hy9bs4xvm25eQM3jOqQkM5hz5MsHEZ0Ef5EgJHmK48KODaAreSA+b2kv8rpwJMnjUge2wtlpz J/QN9tzt/mKVkX1Z8UUw3VuVF+Vppkpt4svO4i9gDxh47Wj47B5daIx9X3LIIihn9NvZvSsmH WfoxAC0iublxZUjUemxuR+4aDP5PqPzoLWYJnUMmuj2t5uzgl8XbkSo2i1V+tb8+sYr+NKgUK VdpGcQMT7A7J0eE/CoJeZBEMKoHQtjcM0KMLfyTYWrQVF2WPpn390gYtluHA8AawOnSie5pAk 0AIq0g== From: Markus Elfring Date: Mon, 25 Dec 2023 16:33:22 +0100 The variable “err” will eventually be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/edac/amd64_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index f912cbadefa4..8a27a4af7121 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4396,7 +4396,7 @@ MODULE_DEVICE_TABLE(x86cpu, amd64_cpuids); static int __init amd64_edac_init(void) { const char *owner; - int err = -ENODEV; + int err; int i; if (ghes_get_devices()) From patchwork Mon Dec 25 17:38:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13504718 Received: from mout.web.de (mout.web.de [212.227.17.11]) (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 9A87652F81; Mon, 25 Dec 2023 17:38:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="RA6P1cns" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703525892; x=1704130692; i=markus.elfring@web.de; bh=j0FKcxvxQfC448I2h8pj0eT4D4GEbJBlPEXrdpAO+2I=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=RA6P1cns5bH5XZAkWogysVVZpXDL1ov0hIdI0dFSrPlsRyIuZIfbGUCfsg4muGLu TJWuZ08G/CTjYcRju2Ioh8wjetls2Bzi1MpREpq2PFGfRM1m/TfLvvT9no7InrjfM ZmR2bKpHQqiWMTJbo22X/iIc8oWgcDs7xpN5e/+XuqI/P6duTzRHFYIom5USDcvvs jGAsK+lFh/YWX4cqA58g+WS52yUecM3UyPCU6z4nGfqC+Ib0+vfebvYDcm5VHauMS cWmXMY/CRJb2hT9UqEVoql+5D9m6x3U3unHpt5QJSHtsLam8KEM0ITOMBjAoCD9/H /mmjw5Qnbl+ETXlDDA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M59nK-1rIupc0ws8-001dTT; Mon, 25 Dec 2023 18:38:12 +0100 Message-ID: <644d3bff-5a21-47d2-9e36-06475d472253@web.de> Date: Mon, 25 Dec 2023 18:38:11 +0100 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/7] EDAC/amd64: Merge two if statements into one in amd64_edac_init() Content-Language: en-GB From: Markus Elfring To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org, Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , Tony Luck , Yazen Ghannam Cc: LKML , cocci@inria.fr, Muralidhara M K References: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> X-Provags-ID: V03:K1:0IDoyUT/jRJx6zuJyc7dROs6A+EuRf113hAyHyLWMNk2psUzfIS lvXFoI0/RHVmz5d7VHoNzISVCQ0DAj8CVtcrfZ5JRT6sZWv4ShYtb/sOpYe+9k+CDeQHKOJ zLSSnGl4ulTmfO0A38teQpm/1wAlWmg3hQ14Z+5TapRyVUpYirAq2Go+kcFl4816vUHcWfk 6TCTgWKRI3sWk4kgXPc+Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:eOaklonjYc8=;Oz4K9nCLExNKL/flrq3Vuiou9BZ 5FcXhLT2nr90iWusB8FZiCLXHhZL8CYzHLLoud/gPkFzCsVyu6pqNDyqqe3/H6zV7sRMrIUmb gy7C42jBqpLGslXnl5CVMTvGiteJdYrveFaRqUYW/bsXIp45mjIOWdnAqYcC1EE3SaZYqQ+9u EoTcJX5VPG/LjI7QPSv44vKSYUASIym1XyN0Q//n8iRc4tDGwTEqeis1ScivKEpXiYzkdsW2N dhBmZtF6zo9H3wHcnoxyksiYOiB0Q0phYBBU35VoxTjDzQnSWzAxheGYL53PXq4AhUKimq9to vpZ10WuZ7zVszRJlngNIGjf6dFvZ8l7gFfmJqjrpcQMb/W9xAk3z7o0CcYmDyLNDCvA5lCE8K Ks7ALexQW7bDXUFvPjbbOU/scVd4ulxUqpTcmumfNsA45G7+7rCN+2vaO2vY0Itpki2CqryWK Eo1Nz+nn7Wh00NzniVhOZVhzsE7WifAThccd6hqFeGyT5DUqw05DURVKp02xMoZYSULZfQxi9 yUAXVoh5QVHCjEj3k6QFwWvRXza2P3EgogDs91Ajbyu8WuZXOOMybUzzKQrhWPFI1PkaNc6L/ ZUrkDc6sp8Ekctw6xcq7V4yW3fWYX8irzXET7vgF/XKPbQIoBkDC+PlYJLXVmVfvbDvQ2mKkw Spzf9/OpAVDsK1aPSdvu47UHgHbrOjQ6bGvh7kJAvw1tQl13oy+cYq1dKN9UExurm5MRi52uW xI1xOPdCoDi8aq7kM39WlQ9O3LHF9Uw36kXXbrKrdu6Ren4xhUgfmEVT0nD7eXi97VlfoI8cV IBoW0u/chcni7viCbaQNqOMvIuqiUdv4kQuwqiAvzHTbGZAPBKtRzxbHiMJ2l5/BFo6Ut3fEZ g2me4qOyZPnsl4HOksOKc6sgcv9Zfm4/07S6ppuXvFlGCnOk1QAE7fO0cpu/jlIlqxdRZgBCf VMe70w== From: Markus Elfring Date: Mon, 25 Dec 2023 16:45:37 +0100 Two if statements were connected with the same return statements. Thus merge their condition checks into one statement. Signed-off-by: Markus Elfring --- drivers/edac/amd64_edac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.43.0 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 8a27a4af7121..49f3d9b54902 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4406,10 +4406,7 @@ static int __init amd64_edac_init(void) if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) return -EBUSY; - if (!x86_match_cpu(amd64_cpuids)) - return -ENODEV; - - if (!amd_nb_num()) + if (!x86_match_cpu(amd64_cpuids) || !amd_nb_num()) return -ENODEV; opstate_init(); From patchwork Mon Dec 25 17:40:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13504719 Received: from mout.web.de (mout.web.de [217.72.192.78]) (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 1ED8C524CB; Mon, 25 Dec 2023 17:41:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="Znrfeoeo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703526027; x=1704130827; i=markus.elfring@web.de; bh=YNeHa6/Vcg1bfEGgSJaOADhspsb8ftwtO+I9y532uhg=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=Znrfeoeoa59CuOHeUzQmncuMsM1Y4VQ0XkncIqn7XtNZGwrtQMF0faBI9ovmnqhb h/IHugT7JuSXCf4E+y4fjj0rYIIvdkf1cCMmGyf8+AQkhS+0eA5E4Z/3elC6imRjy V7kWsL/8CGR+aPU5krKuRgqnQ+Y5tWEjeEVwqlmLJ25PBA1g8NExBt62VKYURorZM dTs9/rZZOVKBb2hL4ZyAbAISHEpyy6hQ7C+3Y4Ata3jU8VICSyBJKyImuK8iRJ0Uh o5B5vGcHSdv1SZbrKm0QPtorK5vAUjto67uD6jmhspT4ABLR8UO7dtVvW3fuzUzSE ysn0oxYpMnauUtVUyw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MJFhJ-1rXYP22PGN-00KnpZ; Mon, 25 Dec 2023 18:40:27 +0100 Message-ID: <0dcdeebf-46f1-41c1-b5c8-050bca5d8e1f@web.de> Date: Mon, 25 Dec 2023 18:40:26 +0100 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/7] EDAC/amd64: Adjust error handling in probe_one_instance() Content-Language: en-GB From: Markus Elfring To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org, Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , Tony Luck , Yazen Ghannam Cc: LKML , cocci@inria.fr, Muralidhara M K References: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> X-Provags-ID: V03:K1:f5Qp4CpqwjoAivwiBL1Lm2FPsM4kPStagXR0AuWP/yqBlb8rDYh TGsTJqc0JXESt00jJjej09r/B1RehbaWI5IBVPdDpmTTnq45BahACNmZVWDn3FRx81Zd019 sESxkopVNXd9Li6wxaD1yUB92f3FCdgKHeIglGnCgXc6E1LV6H5BYmGXsNPYoA/2fk0nR41 0g2SrHJ1AFtRe0pu1y22g== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:EXXReGOboJ8=;cYxIzNPVpcl2/7PE0W8rYHHT23K BzTu8iAVmMVC7ICXKdmlrhf1+juIOFkpxKHhAykqEVNbiExeP0gZssJg6NzdclPsMBh6LJF1x mIxgYlLHxqoBWJqzpF0vdgU9R2+iTKzphHRkGUosCZBzGll/YH0nSvjQsOWHEAXFu6oT3EC5u nuyUsgqWKhBv0jOVdTmAHVwaxqpH94S7Dar+yqFbrrD8VC7cs/OSDy8m9bPPas+i/tHT+H5pH 4XjWXm5kWqYhvLE6n65QgB6XjAqzMHMV4757NmtWVLIzusA0qlD6oV45WxXTfQC/lfPz2WJFP 9ye4LuYvVeoFxkGUXVITr/RtOg6pQUY8oDxc0+YHDD70q9XBnlHDeYX0y3M+tTyVJSpXWjxwk EN8zpC1QQ8jA/8mfEbUx1RJtd3B3J78tWamplcbKK7I95d79y8Xhr8YhcQ6KOoCZkqE/xI011 F8WYA3GJL7/n1zCpSAD/Z5P8AeaNjtG/szFImOiX+ksczPROIWHLbKib1pR1gNtXtVPGAqFML 4gOcDedLhpp7+pQLytALS+BGZFHQrr0AKmSxMFUHEF94rsTQkK5IK6PAwk7Td7PvTPGB75kbh dt79zorB+Q0fV1XFV0UGTQvoqedZDpWORXBLzhLSlNHJdUalzadfwfyWtUjuvqW7iJNp3Ayfu T1UabhreQACqC6XAmL5EU0AaFUvoEqAhesKe5+u8BcNONrzvFLifujRAiGwZgPCAj561M1Cnc 61a+MBK4CtxqADV5ZPNwCEbh7Dai2QyzcSTjwSAONNwPRvW9lSAiDlFcC9sZw8nxcKPEVOGAd AzLs5sHV0dUEkRRIwxQmVjO/L/Q7Jwak7ZGQbi9G7vj5nzoUuohs+d9bTBo3vQTwCfHW6WQAP wfS7MGcL1PMl2Ip5LTgx9bNF5T/Ruy1jQ9sSSnKWuGwEPQmHUrQXfW5z210US20r7rOIm6uqe yNp/Ig== From: Markus Elfring Date: Mon, 25 Dec 2023 17:18:14 +0100 1. Return directly after a call of the function “kzalloc” failed at the beginning. 2. Delete the label “err_out” which became unnecessary with this refactoring. 3. Move an error code assignment into an if branch. Signed-off-by: Markus Elfring --- drivers/edac/amd64_edac.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.43.0 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 49f3d9b54902..64680de47cab 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4268,16 +4268,17 @@ static int probe_one_instance(unsigned int nid) struct ecc_settings *s; int ret; - ret = -ENOMEM; s = kzalloc(sizeof(struct ecc_settings), GFP_KERNEL); if (!s) - goto err_out; + return -ENOMEM; ecc_stngs[nid] = s; pvt = kzalloc(sizeof(struct amd64_pvt), GFP_KERNEL); - if (!pvt) + if (!pvt) { + ret = -ENOMEM; goto err_settings; + } pvt->mc_node_id = nid; pvt->F3 = F3; @@ -4336,8 +4337,6 @@ static int probe_one_instance(unsigned int nid) err_settings: kfree(s); ecc_stngs[nid] = NULL; - -err_out: return ret; } From patchwork Mon Dec 25 17:42:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13504721 Received: from mout.web.de (mout.web.de [217.72.192.78]) (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 0280152F81; Mon, 25 Dec 2023 17:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="GUGCLXGK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703526136; x=1704130936; i=markus.elfring@web.de; bh=DN1DZ8Q4gr5JZBxx9y14h9ITgGHp31mL41Pkj2olJ1A=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=GUGCLXGK50GeUpvRJtg0JnwjPvlj9KjLdZ6hnHgCZ7nV6QgNCMmrcpzpwAQ70Ol7 qO5R2gtqkc1MNHYTdwh7d631z7rgPuH2OicMr6JTF90SXOG9dLzxaT/JfmECvkJ8n +0mXs/5ehrzdTNqomfoAgwGC75lvL2pKxtYdyxt7mokmr4xuIL79ohwQ3iIEyBYcD bv9ryRjlgYqFi+ShqU8vXjnryXZgF3Bx6RraD0a2Ac4H2IeSRg/WW2aeyVQuGTRS8 NH2qxhdbeSThfunmlodBXo4K3C1c1ULC1iqhOTD0sqeW4py2h7F6AG+MAk8RM+/dH xmVAZbuSnYkTz+9Ikw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N4eGT-1rAHrb34j9-011WsV; Mon, 25 Dec 2023 18:42:16 +0100 Message-ID: <8ecc9bd5-9001-4844-a3ea-f2b522a73cd3@web.de> Date: Mon, 25 Dec 2023 18:42:15 +0100 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/7] EDAC/amd64: Improve two size determinations in probe_one_instance() Content-Language: en-GB From: Markus Elfring To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org, Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , Tony Luck , Yazen Ghannam Cc: LKML , cocci@inria.fr, Muralidhara M K References: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> X-Provags-ID: V03:K1:2mmKeyB1681GDxQi1sKnPOxPX+IaW+IkMgtER2YiMnejmtGjbMk 3Ko4EESXm92JaHnCN2m0nvkIeD/9+qCD+PJ9jEuMQFRWqwRgx9ByNpHoyRtd04L46Zb3wRx 8tOs7YLcV+gQktydVjndK5GQX9qI3SopK+lN2So6YhhfQavedtD+5w3lBQZQlf5FXXlZ8JP y4KJGoSkRArEGQ/wJuD7w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:DHtw6zTu/ns=;qWnu/Dj6l7S/ReZRUeGYnZubsgz alUOx57ZHhmLeJNK3u+AxhyisQjpXkeYOr6Gk7Z571mItKHhBpGwrNi8hyJERGTCZOoo74tyn XxlyWNa2uBWxaYlboMZyHOZA3myfX7qOurv1LV4JKj9UeSClXSm762HBvIqzW03e0YRAwrPJo 9RO5Ds4F6U52TZ/tzrfojla58eW+qLPlwJy0FENYXfA14+nZefXeivvyAXhHtPkSRR6nje5Fq NKA7RSZaO+IZJJFIG/Q3NmB7g+t7kh7uWR2ENHwolyNC1Cj+3lymkqVd/PcLqptQScIHi3h8O ePASCHgyQHiTW9wH170nnayAtHFkUApWmPFfx1wAFnJOkbiBVjvjN3xlWmGJWe66EZuQ2Jlsn ytZcneh96QyDJr0OgSZFMjZcL0cJ+O2vGTcfSBXxzwQIucogVgAlJbTbr6i3KdGfMwdeAsc3m 0fO8qO7dR88x2fpB/VcxflEXabc3CLC+RtwTKpkR4/sPEWII1dlGxwIsh/A13oupumo2LNmVO t48TTbPeZISVqp9P8VcIpb7WsVeh/y0DCf4Jb2pAD5eOZvmZZfjXZgGHYSOv79Z8wZGSC/vyu tJgfBmMZHQdheZA3Txh5l681+c4OcDEGaKUI5eNRu5ShvlwCOD8cNSDJLyK6itGTkZdVgi6/W GyA46ziiIrgBci4qobkuYwcqOXVl1mhj1Lw1WMj3FgTfm/2v8MJLbCRIGu79Pljgoc9BK5dam JttUoHilFg6GBKKd4jvxqXP3OEMwX5xWP6EjpxwsQk/tTv2z5hj1lMWVhneS9kw97rdluJVf6 IHUQM4vSFqaqolLsxdf8niYTzHpbUIydjqkZZcrTRC6DjwaEauwFzkOxjft37bqSicfIqThyr qp6eK8wrRm8pNkINAZ5EutPoVfwQbJ71wXjOUQ2BXQkSv5LS/8NyAWA6V/5wkZrV6UyNSoiKu oI0Sky7sHiQiGaCKjaiv2bUrz1s= From: Markus Elfring Date: Mon, 25 Dec 2023 17:24:37 +0100 Replace the specification of data structures by pointer dereferences as the parameter for the operator “sizeof” to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/edac/amd64_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.43.0 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 64680de47cab..7536236df542 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4268,13 +4268,13 @@ static int probe_one_instance(unsigned int nid) struct ecc_settings *s; int ret; - s = kzalloc(sizeof(struct ecc_settings), GFP_KERNEL); + s = kzalloc(sizeof(*s), GFP_KERNEL); if (!s) return -ENOMEM; ecc_stngs[nid] = s; - pvt = kzalloc(sizeof(struct amd64_pvt), GFP_KERNEL); + pvt = kzalloc(sizeof(*pvt), GFP_KERNEL); if (!pvt) { ret = -ENOMEM; goto err_settings; From patchwork Mon Dec 25 17:44:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13504722 Received: from mout.web.de (mout.web.de [212.227.17.12]) (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 3ADC252F81; Mon, 25 Dec 2023 17:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="BRgVjKbC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703526253; x=1704131053; i=markus.elfring@web.de; bh=RztvVJkiqN6k6MAkMSOfzbHfNuTEw4Oiqcl/UjOdytc=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=BRgVjKbCkwimRPbV0xi6sn4JfyUN/SzJgjz8cOM5S2JoP1OXON/UwUFDpHauZHqm tOeczZtc4kAH3h4oeMjhT3RatwqgHxRckDEQotpj7/t1W4nnTUE52FbQ4LPyWpwLF Vj/4cq0CClA8GU9SDN/M7dktQakpZRwz4FQk2QPvjz/AKZJHJ4WwQcIIJwhypHHc0 g1cBzDutd44pLitRq4V5q90wCspsx6tQMOPRLqBst0+TlzyV1N68otNR18xCnFbpQ AuaYYK/gZmuBQIcjmGDDk+Qzc1I467ySsCaA/X+9sZky8tToIjTWrA8EAbH9OEqiV 1dvx5Apk+4BxMxvZvg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MVaYw-1rjLj72n6y-00Re9o; Mon, 25 Dec 2023 18:44:13 +0100 Message-ID: Date: Mon, 25 Dec 2023 18:44:12 +0100 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 6/7] EDAC/amd64: Delete an unnecessary variable initialisation in probe_one_instance() Content-Language: en-GB From: Markus Elfring To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org, Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , Tony Luck , Yazen Ghannam Cc: LKML , cocci@inria.fr, Muralidhara M K References: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> X-Provags-ID: V03:K1:tguqig1/d9Gquv0duF+HYbD6u0Nq0ecs9k3puuWqEaduLqMP8OF G4a21omXnXOFpHBg2wi7+aR92clYLkKHm1+9XBeRYSheetn+JsHA9uKBjG0dgaq+zaaR3xY OtNVeH+++yTq54V7fXUILiAmNH9KD2CfeSSAN2G7H1ksOx+KX7WY1kSqHu5L+eu8PhfsrBn AZVC3bVkjhOI0ERjx1mhA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:XsXR/k+e8AY=;T5v8XO6GeyaX87PWrmzvSBStT/Z nLPSHKRzZdcS7j+BOOU6XYHJfHX1wiezd1OFxQpG04KJse2qPMYEBRJKh4nAI+bHvMxwVAIAB vjBwcnsnm5jDO2NosbNcJFc58yGMZm3GMJewRe9lG+yE20eM601t+CGiAMsCPdxiP7G6OrVHJ gsE22naXBT+dxpwcQjDQJL/xRol1qfyDWyiLAvDTmeZQ88DNjKogIyszaSqrEtpIMo/FK5TIo x0T2Odztm+LGQKYNH2MfiN71BIh28whLF9lK7LZCOuu2Ky5I4xplJSNsQtVstIDFSW65VE87P GSyfpghMAUhhgIP58YwemmIUADW4elWCCyzzhDd+kMJuZ+qx0eMksumHfknPMrJ6bg86T58GA 5HZ4wpfDv/xTfxA8Fyu1X/ENw7SVc7iSi0A4ei4R93BpqO85dVatdGQxhHeLPqiQtbawtR4Fy Xm7/emiaHBOoXF0XotHtHcG9UphMCPmQGZ7pVPQd3WFARZtMUDs9ECXLDXnEc8frWyxduR6Ub hc3C7/sO71h/8MIonMNgBkdKaOeIBSryK9IE/c1uSCrbT7wtp2NgU4HCA2k7FefpYhCbSEYt3 EPUgbU0ZEC0QOm62+IAvASGMbV93JXtKN3qto+mDHqwjVE0YbWwKFS/iIsRWqYqVioX1yJfqu 4JtY1OKNFrN97jBU3/bYOZ7H/CO+nS1D44D5A8Va+dTAJBS8/TTRJwrkrW59VTQsQBj+1UitU FH6Qmyvlx76pVpTSySZyc1icdN4OprxM/R2IedGGIXOmJ8yEnnSA3EcYz+Mifc5hgqBHj4OK+ GbW0U2f/bKMB/zbkuuOal0pBVgxSDpgkPdIOxZQdL3ASKerCoA954gVltfxLrRIPoqGCtghuy Y7PVG5mqy+L+fhAsbtG3KAl0KAsiNASLtXLzGErxqdu5epnuOdOMyKrK4FnyqgJ4L0rbVnoqO F4dysw== From: Markus Elfring Date: Mon, 25 Dec 2023 17:34:35 +0100 The variable “pvt” will eventually be set to an appropriate pointer a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/edac/amd64_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 7536236df542..698cde573847 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -4264,7 +4264,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 amd64_pvt *pvt = NULL; + struct amd64_pvt *pvt; struct ecc_settings *s; int ret; From patchwork Mon Dec 25 17:46:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13504723 Received: from mout.web.de (mout.web.de [212.227.17.12]) (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 A220D52F6C; Mon, 25 Dec 2023 17:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="GiO7qeHC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703526384; x=1704131184; i=markus.elfring@web.de; bh=yZfNVyN4f4vfAqTUZd3nhSOWUqIAg4Bk9xRcEkmGZ5M=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=GiO7qeHCXutEbfDxFIdz4So3jEDLAuTIEVpxo6C6Hd7t9H3wD2azDaACSutB62aQ YwqXdfHwqdzHRLMyn0Z2L1I+524QFb6MXZCjg7gR+CrtHia7VmbV6QlGEIxmjPM1w 3JJAj9p+eRGZ/kCBzT/Ma9GcDjJqa2X9FDKu/VdvBRaqolrAh32WOTUNASbU+mnLn 4L6GnoftHVl4140LMk7mGlMRx5csm6qinrSpYKkEEkoXZKr2ewbbu5yqZZqtqWYHl GLBShQsPoandcv0O205o3ggQYErKlhypAoOb/Fl8vumw0Ra5luK1E4floSkx+i/B9 98H/MVwTv4CnuD3jyA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MS17h-1rgJlD0Q8J-00TZ2O; Mon, 25 Dec 2023 18:46:24 +0100 Message-ID: <15936ac5-5380-42fa-b13a-e6b2ccf92490@web.de> Date: Mon, 25 Dec 2023 18:46:22 +0100 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: =?utf-8?q?=5BPATCH_7/7=5D_EDAC/amd64=3A_Move_an_assignment_for_the_?= =?utf-8?q?variable_=E2=80=9CF3=E2=80=9D_in_probe=5Fone=5Finstance=28=29?= Content-Language: en-GB From: Markus Elfring To: linux-edac@vger.kernel.org, kernel-janitors@vger.kernel.org, Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , Tony Luck , Yazen Ghannam Cc: LKML , cocci@inria.fr, Muralidhara M K References: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> In-Reply-To: <8c9e2c01-9ed0-4392-af40-4e8eb393cb67@web.de> X-Provags-ID: V03:K1:66u+l/NmUncqbzV4DyhYiHKTFwdL8r80fp0lKBBqJ4Se1lKH36E GRmsALRYZzIW/mZQat/0+0+7qD1JqwkFqKB1IjRWouz9CCsUT3Q1Xn7MOSCIkdWAg0LlRPY fsTP51u3VQUz6c4p72SnFchlNUCxKVUE8v9BRvw3ZqJem/eJCNJIHoqdnUGko/13jb6Fh+Z mZXcmp6jjjDEZmDhtHGSA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:vZ18hv2qYMk=;dqmj3WTTTp6yGfjGEUHWNrWEOJU yt2QYNCgE0N5ixA/hQm26un+3Uzx029yhuNPS8eyYQw44Mb9/856Jvi328c4KjUHx5dyB31jR bmQ2FLL2iH/meS+Rh/adpIgGW/wu6NKPnCL1n9eLMFoMKLUiXz99Puwjz+1dL1O+HhzLz09RI A1KVzV80mW2YKtageXbFY1VuXlFlRTwBFlMVv9mfCYleqvgeZtSeicfXqAjxLWBC52umcmN6A VbfKqgIdcyB0RvK3WcxnhKqiSppA9Rj9NQHlNLOWFEfhgv7BYXr+yJsb33sEskYCjVOBQS3D8 qOhCwOPRytdLEhbUcUKuE8lcCyrxrZh2Sd4onQBKsy14OIm5VEOqrmTDaGtuGL0v88whKKnZd cG5JQ+K1EVxYAxb/veAHWtOso9f8rcFMKdy7KVMcdI52hawN77L/rsBzhPcm2fkhnUl3WOadn oyEbKEYKCi0pKtThDZgALTSqvpXYbW5YlpPsr8xG8pIJUmW6hvVnjhDU10WW6kOfRg/BsLvcq 9E/Mx9nbddgtpIySrnAlnZRBqJwx3Ifb9mNWZh3k74FGuyijm1pN44+kUspkS4aXRNfOZOVoL VdhYNpARcU7Bjwa8UuvZ8T2eG+rGoHQ4a/tr0JOLGYuFWqgD6/8PUXT0ZphRPRxu3oznk93/4 dU89SApnK96KCVuqQyZxNc72NhFenzVvgyuHzktkaSUWEJoQuv1ianExWedXUF6deXzfPOBc8 N/e7UX5+zQPnQ3lSs8t69XhGz7JuWprKS7yKoI6D4JI3NceCYFiQPmSuPfLVbNn1gmxnmODz8 9/cHwOAKOz4buRNFxA7tQDa6NeDtKW+PuZHDGW5oHAPrn+ED9yrxpP+j/qe0UVwXjRGaCclnj j9s0TbFd4HatEHu3M2S5HVO+aJ3f4aVFFuaXI7lGhF7GL7TnHuUqnlMudtL//4VMqTBzw4xhY J/d6AQ== From: Markus Elfring 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 --- drivers/edac/amd64_edac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.43.0 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);