All of lore.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-clk@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/4] clk-u300: Improve a size determination in two functions
Date: Tue, 26 Sep 2017 18:22:25 +0000	[thread overview]
Message-ID: <781271c5-482f-d4da-e91e-3b048bac69c2@users.sourceforge.net> (raw)
In-Reply-To: <a81e53f2-53ee-cf2d-1a0a-f1e3e24a5b9d@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 26 Sep 2017 19:33:02 +0200

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.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/clk-u300.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-u300.c b/drivers/clk/clk-u300.c
index e524c3775264..ae78461c7836 100644
--- a/drivers/clk/clk-u300.c
+++ b/drivers/clk/clk-u300.c
@@ -702,7 +702,7 @@ syscon_clk_register(struct device *dev, const char *name,
 	struct clk_init_data init;
 	int ret;
 
-	sclk = kzalloc(sizeof(struct clk_syscon), GFP_KERNEL);
+	sclk = kzalloc(sizeof(*sclk), GFP_KERNEL);
 	if (!sclk)
 		return ERR_PTR(-ENOMEM);
 
@@ -1121,7 +1121,7 @@ mclk_clk_register(struct device *dev, const char *name,
 	struct clk_init_data init;
 	int ret;
 
-	mclk = kzalloc(sizeof(struct clk_mclk), GFP_KERNEL);
+	mclk = kzalloc(sizeof(*mclk), GFP_KERNEL);
 	if (!mclk)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.14.1


WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-clk@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/4] clk-u300: Improve a size determination in two functions
Date: Tue, 26 Sep 2017 20:22:25 +0200	[thread overview]
Message-ID: <781271c5-482f-d4da-e91e-3b048bac69c2@users.sourceforge.net> (raw)
In-Reply-To: <a81e53f2-53ee-cf2d-1a0a-f1e3e24a5b9d@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 26 Sep 2017 19:33:02 +0200

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.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/clk-u300.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-u300.c b/drivers/clk/clk-u300.c
index e524c3775264..ae78461c7836 100644
--- a/drivers/clk/clk-u300.c
+++ b/drivers/clk/clk-u300.c
@@ -702,7 +702,7 @@ syscon_clk_register(struct device *dev, const char *name,
 	struct clk_init_data init;
 	int ret;
 
-	sclk = kzalloc(sizeof(struct clk_syscon), GFP_KERNEL);
+	sclk = kzalloc(sizeof(*sclk), GFP_KERNEL);
 	if (!sclk)
 		return ERR_PTR(-ENOMEM);
 
@@ -1121,7 +1121,7 @@ mclk_clk_register(struct device *dev, const char *name,
 	struct clk_init_data init;
 	int ret;
 
-	mclk = kzalloc(sizeof(struct clk_mclk), GFP_KERNEL);
+	mclk = kzalloc(sizeof(*mclk), GFP_KERNEL);
 	if (!mclk)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.14.1

  parent reply	other threads:[~2017-09-26 18:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26 18:20 [PATCH 0/4] U300 clock: Adjustments for three function implementations SF Markus Elfring
2017-09-26 18:20 ` SF Markus Elfring
2017-09-26 18:21 ` [PATCH 1/4] clk-u300: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-09-26 18:21   ` SF Markus Elfring
2017-11-14  1:58   ` Stephen Boyd
2017-11-14  1:58     ` Stephen Boyd
2017-09-26 18:22 ` SF Markus Elfring [this message]
2017-09-26 18:22   ` [PATCH 2/4] clk-u300: Improve a size determination " SF Markus Elfring
2017-11-14  1:58   ` Stephen Boyd
2017-11-14  1:58     ` Stephen Boyd
2017-09-26 18:23 ` [PATCH 3/4] clk-u300: Add some spaces for better code readability SF Markus Elfring
2017-09-26 18:23   ` SF Markus Elfring
2017-11-14  1:58   ` Stephen Boyd
2017-11-14  1:58     ` Stephen Boyd
2017-09-26 18:25 ` [PATCH 4/4] clk-u300: Fix a typo in two comment lines SF Markus Elfring
2017-09-26 18:25   ` SF Markus Elfring
2017-11-14  1:58   ` Stephen Boyd
2017-11-14  1:58     ` Stephen Boyd

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=781271c5-482f-d4da-e91e-3b048bac69c2@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.