Message ID | 20230203132714.1931596-1-claudiu.beznea@microchip.com |
---|---|
State | Accepted |
Commit | 1c4e5c470a56f7f7c649c0c70e603abc1eab15c4 |
Headers | show |
Series | pinctrl: at91: use devm_kasprintf() to avoid potential leaks | expand |
On Fri, Feb 3, 2023 at 2:29 PM Claudiu Beznea <claudiu.beznea@microchip.com> wrote: > 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> Patch applied! Yours, Linus Walleij
diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 39b233f73e13..373eed8bc4be 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -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; diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 1e1813d7c550..c405296e4989 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1885,7 +1885,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;
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> --- drivers/pinctrl/pinctrl-at91-pio4.c | 4 ++-- drivers/pinctrl/pinctrl-at91.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)