Skip to content

Commit

Permalink
pinctrl: at91: use devm_kasprintf() to avoid potential leaks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Claudiu Beznea authored and Linus Walleij committed Feb 6, 2023
1 parent 4b6b185 commit 1c4e5c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drivers/pinctrl/pinctrl-at91-pio4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,8 +1149,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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pinctrl/pinctrl-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,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;

Expand Down

0 comments on commit 1c4e5c4

Please sign in to comment.