linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] clk: fixed-rate: Don't open code kstrdup()
@ 2012-03-21 20:01 Mark Brown
  2012-03-21 20:01 ` [PATCH 2/4] clk: Constify parent name arrays Mark Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Mark Brown @ 2012-03-21 20:01 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-03-22 18:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21 20:01 [PATCH 1/4] clk: fixed-rate: Don't open code kstrdup() Mark Brown
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

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).