]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
bus: arm-ccn: Simplify code
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 27 Aug 2017 10:07:06 +0000 (11:07 +0100)
committerPawel Moll <pawel.moll@arm.com>
Mon, 4 Dec 2017 16:49:50 +0000 (16:49 +0000)
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>
drivers/bus/arm-ccn.c

index a7951662f85b74cfaefc88067b1ebb15102613c3..bbc1a2ef96390833ab5eaa6bbcc1dfb8872a0a0e 100644 (file)
@@ -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 */