Skip to content

Commit 04e60d7

Browse files
krzkandersson
authored andcommitted
soc: qcom: llcc: simplify with cleanup.h
Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent d99b680 commit 04e60d7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/soc/qcom/llcc-qcom.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/bitfield.h>
88
#include <linux/bitmap.h>
99
#include <linux/bitops.h>
10+
#include <linux/cleanup.h>
1011
#include <linux/device.h>
1112
#include <linux/io.h>
1213
#include <linux/kernel.h>
@@ -1294,16 +1295,13 @@ static int qcom_llcc_probe(struct platform_device *pdev)
12941295

12951296
/* Initialize rest of LLCC bank regmaps */
12961297
for (i = 1; i < num_banks; i++) {
1297-
char *base = kasprintf(GFP_KERNEL, "llcc%d_base", i);
1298+
char *base __free(kfree) = kasprintf(GFP_KERNEL, "llcc%d_base", i);
12981299

12991300
drv_data->regmaps[i] = qcom_llcc_init_mmio(pdev, i, base);
13001301
if (IS_ERR(drv_data->regmaps[i])) {
13011302
ret = PTR_ERR(drv_data->regmaps[i]);
1302-
kfree(base);
13031303
goto err;
13041304
}
1305-
1306-
kfree(base);
13071305
}
13081306

13091307
drv_data->bcast_regmap = qcom_llcc_init_mmio(pdev, i, "llcc_broadcast_base");

0 commit comments

Comments
 (0)