net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe
devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.
Fixes: 05bd97fc55
("net: dsa: Add Vitesse VSC73xx DSA router driver")
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240111072018.75971-1-chentao@kylinos.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
03fb8565c8
commit
776dac5a66
|
@ -1135,6 +1135,8 @@ static int vsc73xx_gpio_probe(struct vsc73xx *vsc)
|
|||
|
||||
vsc->gc.label = devm_kasprintf(vsc->dev, GFP_KERNEL, "VSC%04x",
|
||||
vsc->chipid);
|
||||
if (!vsc->gc.label)
|
||||
return -ENOMEM;
|
||||
vsc->gc.ngpio = 4;
|
||||
vsc->gc.owner = THIS_MODULE;
|
||||
vsc->gc.parent = vsc->dev;
|
||||
|
|
Loading…
Reference in New Issue