summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2017-08-27 12:07:06 +0200
committerPawel Moll <pawel.moll@arm.com>2017-12-04 17:49:50 +0100
commit0f9afd36bac9543bc087b77016311c3394bd77c2 (patch)
tree4045d40518548e3912490aa20a686c4072e4e50d /drivers
parentbus: arm-ccn: Check memory allocation failure (diff)
downloadlinux-0f9afd36bac9543bc087b77016311c3394bd77c2.tar.xz
linux-0f9afd36bac9543bc087b77016311c3394bd77c2.zip
bus: arm-ccn: Simplify code
Use 'devm_kasprintf()' to simplify the code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bus/arm-ccn.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
index a7951662f85b..bbc1a2ef9639 100644
--- a/drivers/bus/arm-ccn.c
+++ b/drivers/bus/arm-ccn.c
@@ -1268,14 +1268,12 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
if (ccn->dt.id == 0) {
name = "ccn";
} else {
- int len = snprintf(NULL, 0, "ccn_%d", ccn->dt.id);
-
- name = devm_kzalloc(ccn->dev, len + 1, GFP_KERNEL);
+ name = devm_kasprintf(ccn->dev, GFP_KERNEL, "ccn_%d",
+ ccn->dt.id);
if (!name) {
err = -ENOMEM;
goto error_choose_name;
}
- snprintf(name, len + 1, "ccn_%d", ccn->dt.id);
}
/* Perf driver registration */