public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: ibm-acpi-devel@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org,
	Andy Shevchenko <andy@infradead.org>,
	Darren Hart <dvhart@infradead.org>,
	Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] platform/x86/thinkpad_acpi: Improve a size determination in tpacpi_new_rfkill()
Date: Mon, 18 Dec 2017 21:30:05 +0000	[thread overview]
Message-ID: <36da9194-4254-91ef-5b82-ab150801b911@users.sourceforge.net> (raw)
In-Reply-To: <81459d11-693a-eb51-9173-9c189677f422@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 18 Dec 2017 22:13:53 +0100

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/platform/x86/thinkpad_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 729144925880..40b7a1b9a019 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -1258,7 +1258,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id,
 
 	BUG_ON(id >= TPACPI_RFK_SW_MAX || tpacpi_rfkill_switches[id]);
 
-	atp_rfk = kzalloc(sizeof(struct tpacpi_rfk), GFP_KERNEL);
+	atp_rfk = kzalloc(sizeof(*atp_rfk), GFP_KERNEL);
 	if (atp_rfk)
 		atp_rfk->rfkill = rfkill_alloc(name,
 						&tpacpi_pdev->dev,
-- 
2.15.1


  parent reply	other threads:[~2017-12-18 21:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 21:26 [PATCH 0/2] platform/x86/thinkpad_acpi: Adjustments for four function implementations SF Markus Elfring
2017-12-18 21:28 ` [PATCH 1/2] platform/x86/thinkpad_acpi: Delete an error message for a failed memory allocation in th SF Markus Elfring
2017-12-18 21:30 ` SF Markus Elfring [this message]
2017-12-19 14:37 ` [PATCH 0/2] platform/x86/thinkpad_acpi: Adjustments for four function implementations Andy Shevchenko
2017-12-19 16:23   ` SF Markus Elfring
2017-12-19 17:28     ` Andy Shevchenko
2017-12-23  1:40     ` Henrique de Moraes Holschuh
2017-12-23  7:12       ` SF Markus Elfring
2018-01-03  0:10         ` Darren Hart
2018-01-03  0:49           ` Joe Perches
2018-01-03  1:13             ` Darren Hart
2018-01-03  8:41           ` SF Markus Elfring
2018-01-06  1:26             ` Darren Hart
2018-01-06  8:55               ` SF Markus Elfring
2017-12-23  1:29   ` [PATCH 0/2] " Henrique de Moraes Holschuh

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=36da9194-4254-91ef-5b82-ab150801b911@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ibm-acpi@hmh.eng.br \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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