From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] clk: fixed-rate: Don't open code kstrdup()
Date: Wed, 21 Mar 2012 20:01:19 +0000 [thread overview]
Message-ID: <1332360082-25092-1-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
Save a little code by using the library function.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/clk/clk-fixed-rate.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c
index 90c79fb..cf84e41 100644
--- a/drivers/clk/clk-fixed-rate.c
+++ b/drivers/clk/clk-fixed-rate.c
@@ -45,7 +45,6 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
{
struct clk_fixed_rate *fixed;
char **parent_names = NULL;
- u8 len;
fixed = kzalloc(sizeof(struct clk_fixed_rate), GFP_KERNEL);
@@ -63,14 +62,10 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
if (! parent_names)
goto out;
- len = sizeof(char) * strlen(parent_name);
-
- parent_names[0] = kmalloc(len, GFP_KERNEL);
+ parent_names[0] = kstrdup(parent_name, GFP_KERNEL);
if (!parent_names[0])
goto out;
-
- strncpy(parent_names[0], parent_name, len);
}
out:
--
1.7.9.1
next reply other threads:[~2012-03-21 20:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-21 20:01 Mark Brown [this message]
2012-03-21 20:01 ` [PATCH 2/4] clk: Constify parent name arrays Mark Brown
2012-03-21 20:01 ` [PATCH 3/4] clk: Provide dummy clk_unregister() Mark Brown
2012-03-21 20:36 ` Turquette, Mike
2012-03-21 20:01 ` [PATCH 4/4] clk: wm831x: Add initial WM831x clock driver Mark Brown
2012-03-21 22:26 ` Sascha Hauer
2012-03-22 11:15 ` Mark Brown
2012-03-22 11:26 ` Sascha Hauer
2012-03-22 11:33 ` Mark Brown
2012-03-22 18:35 ` Turquette, Mike
2012-03-22 18:44 ` Mark Brown
2012-03-21 20:32 ` [PATCH 1/4] clk: fixed-rate: Don't open code kstrdup() Turquette, Mike
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=1332360082-25092-1-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).