From 0f9afd36bac9543bc087b77016311c3394bd77c2 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 27 Aug 2017 11:07:06 +0100 Subject: [PATCH] bus: arm-ccn: Simplify code Use 'devm_kasprintf()' to simplify the code. Signed-off-by: Christophe JAILLET Acked-by: Scott Branden Signed-off-by: Pawel Moll --- drivers/bus/arm-ccn.c | 6 ++---- 1 file 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 */