pinctrl: keembay: fix double free in keembay_build_functions()
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 4 Sep 2025 18:58:54 +0000 (21:58 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 8 Sep 2025 12:24:12 +0000 (14:24 +0200)
This kfree() was accidentally left over when we converted to devm_
and it would lead to a double free.  Delete it.

Fixes: 995bc9f4826e ("pinctrl: keembay: release allocated memory in detach path")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-keembay.c

index 30122ca..3241d3a 100644 (file)
@@ -1643,10 +1643,8 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)
        new_funcs = devm_krealloc_array(kpc->dev, keembay_funcs,
                                        kpc->nfuncs, sizeof(*new_funcs),
                                        GFP_KERNEL);
-       if (!new_funcs) {
-               kfree(keembay_funcs);
+       if (!new_funcs)
                return -ENOMEM;
-       }
 
        return keembay_add_functions(kpc, new_funcs);
 }