[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1403192765-3258-4-git-send-email-rob.jones@codethink.co.uk>
Date: Thu, 19 Jun 2014 16:46:04 +0100
From: Rob Jones <rob.jones@...ethink.co.uk>
To: linus.walleij@...aro.org, gnurou@...il.com
Cc: lgirdwood@...il.com, broonie@...nel.org,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kernel@...ethink.co.uk, ian.molton@...ethink.co.uk,
ben.dooks@...ethink.co.uk, heiko@...ech.de,
rob.jones@...ethink.co.uk
Subject: [PATCH 3/4] drivers/base: devres.c: use devm_kmemdup() from with devm_kstrdup()
Avoid code duplication by using devm_kmemdup() to copy data instead
of having a separate loop within devm_kstrdup().
Reviewed-by: Ian Molton <ian.molton@...ethink.co.uk>
Signed-off-by: Rob Jones <rob.jones@...ethink.co.uk>
---
drivers/base/devres.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 9d0f64c..cf19664 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -802,17 +802,10 @@ EXPORT_SYMBOL_GPL(devm_kmalloc);
*/
char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp)
{
- size_t size;
- char *buf;
-
if (!s)
return NULL;
- size = strlen(s) + 1;
- buf = devm_kmalloc(dev, size, gfp);
- if (buf)
- memcpy(buf, s, size);
- return buf;
+ return devm_kmemdup(dev, s, (strlen(s) + 1), gfp);
}
EXPORT_SYMBOL_GPL(devm_kstrdup);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists