mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 09:25:22 +02:00
pinctrl: apple: check devm_kasprintf() returned value
commit665a58fe66
upstream. devm_kasprintf() can return a NULL pointer on failure but this returned value is not checked. Fix this lack and check the returned value. Found by code review. Cc: stable@vger.kernel.org Fixes:a0f160ffcb
("pinctrl: add pinctrl/GPIO driver for Apple SoCs") Signed-off-by: Ma Ke <make24@iscas.ac.cn> Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/20240905020917.356534-1-make24@iscas.ac.cn Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3b36bb1fca
commit
fad940e2dd
|
@ -474,6 +474,9 @@ static int apple_gpio_pinctrl_probe(struct platform_device *pdev)
|
|||
for (i = 0; i < npins; i++) {
|
||||
pins[i].number = i;
|
||||
pins[i].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "PIN%u", i);
|
||||
if (!pins[i].name)
|
||||
return -ENOMEM;
|
||||
|
||||
pins[i].drv_data = pctl;
|
||||
pin_names[i] = pins[i].name;
|
||||
pin_nums[i] = i;
|
||||
|
|
Loading…
Reference in New Issue
Block a user