summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/vitesse-vsc73xx-core.c
diff options
context:
space:
mode:
authorKunwu Chan <chentao@kylinos.cn>2024-01-11 15:20:18 +0800
committerJakub Kicinski <kuba@kernel.org>2024-01-16 17:48:27 -0800
commit776dac5a662774f07a876b650ba578d0a62d20db (patch)
tree1ac93523fc5246c1ecda77a33c870e1ff5af39c2 /drivers/net/dsa/vitesse-vsc73xx-core.c
parent03fb8565c880d57952d9b4ba0b36468bae52b554 (diff)
downloadlinux-776dac5a662774f07a876b650ba578d0a62d20db.tar.gz
linux-776dac5a662774f07a876b650ba578d0a62d20db.tar.bz2
linux-776dac5a662774f07a876b650ba578d0a62d20db.zip
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: 05bd97fc559d ("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>
Diffstat (limited to 'drivers/net/dsa/vitesse-vsc73xx-core.c')
-rw-r--r--drivers/net/dsa/vitesse-vsc73xx-core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c
index dd50502e2122..ae70eac3be28 100644
--- a/drivers/net/dsa/vitesse-vsc73xx-core.c
+++ b/drivers/net/dsa/vitesse-vsc73xx-core.c
@@ -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;