Skip to content

Commit

Permalink
bus: arm-ccn: Simplify code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christophe JAILLET authored and Pawel Moll committed Dec 4, 2017
1 parent 2477117 commit 0f9afd3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/bus/arm-ccn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 0f9afd3

Please sign in to comment.