summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-08-06 14:59:00 +0200
committerMark Brown <broonie@linaro.org>2014-08-16 17:14:09 -0500
commit43937455c9bf294cffc2f25c4a4d0a1b9bbd88e6 (patch)
tree304bcb684e8153f5238ced40683c0e7474c441b2 /drivers/spi
parentd64b472678e17ef9afb251577f4f544793483fa9 (diff)
downloadblackbird-op-linux-43937455c9bf294cffc2f25c4a4d0a1b9bbd88e6.tar.gz
blackbird-op-linux-43937455c9bf294cffc2f25c4a4d0a1b9bbd88e6.zip
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>
Diffstat (limited to 'drivers/spi')
-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);
}
OpenPOWER on IntegriCloud