mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/5] irqchip/irq-gic-v2m: Improve a size determination in gicv2m_init_one()
Date: Thu, 18 Jan 2018 17:24:30 +0100	[thread overview]
Message-ID: <10ededda-66a9-001c-4ad6-db5baa80b679@users.sourceforge.net> (raw)
In-Reply-To: <cd9daaf3-677e-9845-0d36-b6826b3457b5@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 18 Jan 2018 16:07:41 +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/irqchip/irq-gic-v2m.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index b795fefafb12..930261710ba2 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -306,9 +306,8 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode,
 				  struct resource *res)
 {
 	int ret;
-	struct v2m_data *v2m;
+	struct v2m_data *v2m = kzalloc(sizeof(*v2m), GFP_KERNEL);
 
-	v2m = kzalloc(sizeof(struct v2m_data), GFP_KERNEL);
 	if (!v2m)
 		return -ENOMEM;
 
-- 
2.15.1

  parent reply	other threads:[~2018-01-18 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 16:21 [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations SF Markus Elfring
2018-01-18 16:22 ` [PATCH 1/5] irqchip/irq-gic-v2m: Delete an error message for a failed memory allocation in gicv2m_init_one() SF Markus Elfring
2018-01-18 16:24 ` SF Markus Elfring [this message]
2018-01-18 16:25 ` [PATCH 3/5] irqchip/irq-gic-v2m: Mark a of_device_id variable as "const" SF Markus Elfring
2018-01-18 16:26 ` [PATCH 4/5] irqchip/irq-gic-v3-its: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2018-01-18 16:27 ` [PATCH 5/5] irqchip/irq-gic-v3-its: Mark an array of text strings as "const" SF 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=10ededda-66a9-001c-4ad6-db5baa80b679@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=jason@lakedaemon.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome