]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
soc: qcom: llcc: simplify with cleanup.h
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 3 Jul 2024 09:42:36 +0000 (11:42 +0200)
committerBjorn Andersson <andersson@kernel.org>
Sat, 6 Jul 2024 17:56:49 +0000 (12:56 -0500)
Allocate the memory with scoped/cleanup.h to reduce error handling and
make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240703-thermal-const-v1-1-6e59e139c65d@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/llcc-qcom.c

index 110b1f89aa59cf7c67a28537bd76e263cb2d6a7f..37e11e501728594b3eff134e1fde806a47bb3ffc 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/bitfield.h>
 #include <linux/bitmap.h>
 #include <linux/bitops.h>
+#include <linux/cleanup.h>
 #include <linux/device.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
@@ -1294,16 +1295,13 @@ static int qcom_llcc_probe(struct platform_device *pdev)
 
        /* Initialize rest of LLCC bank regmaps */
        for (i = 1; i < num_banks; i++) {
-               char *base = kasprintf(GFP_KERNEL, "llcc%d_base", i);
+               char *base __free(kfree) = kasprintf(GFP_KERNEL, "llcc%d_base", i);
 
                drv_data->regmaps[i] = qcom_llcc_init_mmio(pdev, i, base);
                if (IS_ERR(drv_data->regmaps[i])) {
                        ret = PTR_ERR(drv_data->regmaps[i]);
-                       kfree(base);
                        goto err;
                }
-
-               kfree(base);
        }
 
        drv_data->bcast_regmap = qcom_llcc_init_mmio(pdev, i, "llcc_broadcast_base");