]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
pinctrl: at91: use devm_kasprintf() to avoid potential leaks
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Fri, 3 Feb 2023 13:27:14 +0000 (15:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:59 +0000 (09:33 +0100)
[ Upstream commit 1c4e5c470a56f7f7c649c0c70e603abc1eab15c4 ]

Use devm_kasprintf() instead of kasprintf() to avoid any potential
leaks. At the moment drivers have no remove functionality thus
there is no need for fixes tag.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230203132714.1931596-1-claudiu.beznea@microchip.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/pinctrl-at91-pio4.c
drivers/pinctrl/pinctrl-at91.c

index 82b921fd630d5261d8f912c8e294cc3a1652dbfc..7f193f2b1566ab2fa2b196b0f276e2e3d6408fcc 100644 (file)
@@ -1120,8 +1120,8 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
 
                pin_desc[i].number = i;
                /* Pin naming convention: P(bank_name)(bank_pin_number). */
-               pin_desc[i].name = kasprintf(GFP_KERNEL, "P%c%d",
-                                            bank + 'A', line);
+               pin_desc[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "P%c%d",
+                                                 bank + 'A', line);
 
                group->name = group_names[i] = pin_desc[i].name;
                group->pin = pin_desc[i].number;
index 81dbffab621fb728d482d2f2b1be840dde9d589f..ff3b6a8a0b170711f79e4911d50da5c8da4b7a19 100644 (file)
@@ -1883,7 +1883,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
        }
 
        for (i = 0; i < chip->ngpio; i++)
-               names[i] = kasprintf(GFP_KERNEL, "pio%c%d", alias_idx + 'A', i);
+               names[i] = devm_kasprintf(&pdev->dev, GFP_KERNEL, "pio%c%d", alias_idx + 'A', i);
 
        chip->names = (const char *const *)names;