public inbox for linux-edac@vger.kernel.org
 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: [PATCH 5/7] EDAC/amd64: Improve two size determinations in probe_one_instance()
Date: Mon, 25 Dec 2023 18:42:15 +0100	[thread overview]
Message-ID: <8ecc9bd5-9001-4844-a3ea-f2b522a73cd3@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: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 <elfring@users.sourceforge.net>
---
 drivers/edac/amd64_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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;
--
2.43.0


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

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

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=8ecc9bd5-9001-4844-a3ea-f2b522a73cd3@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