It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
Signed-off-by: Bo Liu <[email protected]>
---
drivers/ipack/ipack.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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))
--
2.27.0
Hi Bo,
Thanks for your contribution!
Patch is,
Acked-by: Samuel Iglesias Gonsalvez <[email protected]>
Greg, Would you mind picking this patch series through your char-misc
tree?
Thanks!
Sam
On Fri, 2022-08-05 at 05:10 -0400, Bo Liu wrote:
> It's possible that dev_set_name() returns -ENOMEM, catch and handle
> this.
>
> Signed-off-by: Bo Liu <[email protected]>
> ---
> drivers/ipack/ipack.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> 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))