mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
pinctrl: microchip-sgpio: check return value of devm_kasprintf()
[ Upstream commit310cd4c206
] devm_kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script). Fixes:7e5ea974e6
("pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO") Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230615105333.585304-3-claudiu.beznea@microchip.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7d95aa245d
commit
b70a9678af
1 changed files with 3 additions and 0 deletions
|
@ -729,6 +729,9 @@ static int microchip_sgpio_register_bank(struct device *dev,
|
|||
pctl_desc->name = devm_kasprintf(dev, GFP_KERNEL, "%s-%sput",
|
||||
dev_name(dev),
|
||||
bank->is_input ? "in" : "out");
|
||||
if (!pctl_desc->name)
|
||||
return -ENOMEM;
|
||||
|
||||
pctl_desc->pctlops = &sgpio_pctl_ops;
|
||||
pctl_desc->pmxops = &sgpio_pmx_ops;
|
||||
pctl_desc->confops = &sgpio_confops;
|
||||
|
|
Loading…
Add table
Reference in a new issue