summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-08-06 16:59:00 +0400
committerMark Brown <broonie@linaro.org>2014-08-17 02:14:09 +0400
commit43937455c9bf294cffc2f25c4a4d0a1b9bbd88e6 (patch)
tree304bcb684e8153f5238ced40683c0e7474c441b2
parentd64b472678e17ef9afb251577f4f544793483fa9 (diff)
downloadlinux-43937455c9bf294cffc2f25c4a4d0a1b9bbd88e6.tar.xz
spi: rspi: Use devm_kasprintf()
Use the devm_kasprintf() helper function instead of open coding error-prone buffer handling and string formatting. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/spi/spi-rspi.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index a4d8d3cf2912..aa1c6a893570 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -1046,12 +1046,11 @@ static int rspi_request_irq(struct device *dev, unsigned int irq,
irq_handler_t handler, const char *suffix,
void *dev_id)
{
- const char *base = dev_name(dev);
- size_t len = strlen(base) + strlen(suffix) + 2;
- char *name = devm_kzalloc(dev, len, GFP_KERNEL);
+ const char *name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s",
+ dev_name(dev), suffix);
if (!name)
return -ENOMEM;
- snprintf(name, len, "%s:%s", base, suffix);
+
return devm_request_irq(dev, irq, handler, 0, name, dev_id);
}