diff options
author | Kunwu Chan <chentao@kylinos.cn> | 2024-01-11 15:20:18 +0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-01-16 17:48:27 -0800 |
commit | 776dac5a662774f07a876b650ba578d0a62d20db (patch) | |
tree | 1ac93523fc5246c1ecda77a33c870e1ff5af39c2 /drivers/net/dsa/vitesse-vsc73xx-core.c | |
parent | 03fb8565c880d57952d9b4ba0b36468bae52b554 (diff) | |
download | linux-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.c | 2 |
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; |