aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBo Liu <liubo03@inspur.com>2022-08-05 05:10:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-01 16:39:48 +0200
commit621d5d6a83bc92a93c6653fd8a424a63c95269b0 (patch)
tree400627b0482e9bcc4c3206aa2197bcd59d64209a
parentmisc: ocxl: fix possible refcount leak in afu_ioctl() (diff)
downloadlinux-dev-621d5d6a83bc92a93c6653fd8a424a63c95269b0.tar.xz
linux-dev-621d5d6a83bc92a93c6653fd8a424a63c95269b0.zip
ipack: Check dev_set_name() return value
It's possible that dev_set_name() returns -ENOMEM, catch and handle this. Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://lore.kernel.org/r/20220805091057.19951-1-liubo03@inspur.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/ipack/ipack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
index b1c3198355e7..74d449858a61 100644
--- a/drivers/ipack/ipack.c
+++ b/drivers/ipack/ipack.c
@@ -429,8 +429,11 @@ int ipack_device_init(struct ipack_device *dev)
dev->dev.bus = &ipack_bus_type;
dev->dev.release = ipack_device_release;
dev->dev.parent = dev->bus->parent;
- dev_set_name(&dev->dev,
+ ret = dev_set_name(&dev->dev,
"ipack-dev.%u.%u", dev->bus->bus_nr, dev->slot);
+ if (ret)
+ return ret;
+
device_initialize(&dev->dev);
if (dev->bus->ops->set_clockrate(dev, 8))