Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627206
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 6/8] clk: Improve a size determination in two functions |
| Date | 2017-04-20 10:40 +0200 |
| Message-ID | <tyfN8-6Do-13@gated-at.bofh.it> (permalink) |
| References | <tyfDr-6zX-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 20 Apr 2017 09:30:52 +0200
Replace the specification of two 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/clk/clk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 684642ab4212..3f2ee0469d3e 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2939,7 +2939,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb)
/* if clk wasn't in the notifier list, allocate new clk_notifier */
if (cn->clk != clk) {
- cn = kzalloc(sizeof(struct clk_notifier), GFP_KERNEL);
+ cn = kzalloc(sizeof(*cn), GFP_KERNEL);
if (!cn)
goto out;
@@ -3087,7 +3087,7 @@ int of_clk_add_provider(struct device_node *np,
struct of_clk_provider *cp;
int ret;
- cp = kzalloc(sizeof(struct of_clk_provider), GFP_KERNEL);
+ cp = kzalloc(sizeof(*cp), GFP_KERNEL);
if (!cp)
return -ENOMEM;
--
2.12.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] clk: Fine-tuning for ten function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:30 +0200
[PATCH 8/8] clk: nomadik: Delete error messages for a failed memory allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:40 +0200
[PATCH 6/8] clk: Improve a size determination in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:40 +0200
Re: [PATCH 6/8] clk: Improve a size determination in two functions Stephen Boyd <sboyd@codeaurora.org> - 2017-04-22 04:50 +0200
[PATCH 7/8] clk: nomadik: Use seq_puts() in nomadik_src_clk_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:40 +0200
Re: [PATCH 7/8] clk: nomadik: Use seq_puts() in nomadik_src_clk_show() Stephen Boyd <sboyd@codeaurora.org> - 2017-04-22 04:50 +0200
csiph-web