[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240124051254.476341-1-huxiaoying@kylinos.cn>
Date: Wed, 24 Jan 2024 13:12:54 +0800
From: Tom Hu <huxiaoying@...inos.cn>
To: linux-kernel@...r.kernel.org
Cc: minyard@....org,
xiaoying_hu@....com,
huxiaoying <huxiaoying@...inos.cn>
Subject: [PATCH] char: warnning msg for devm_snprintf failed to allocate memory.
From: huxiaoying <huxiaoying@...inos.cn>
Signed-off-by: Tom Hu <huxiaoying@...inos.cn>
---
drivers/char/ipmi/ipmb_dev_int.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c
index 49100845fcb7..8e703ecb27c3 100644
--- a/drivers/char/ipmi/ipmb_dev_int.c
+++ b/drivers/char/ipmi/ipmb_dev_int.c
@@ -321,6 +321,9 @@ static int ipmb_probe(struct i2c_client *client)
ipmb_dev->miscdev.name = devm_kasprintf(&client->dev, GFP_KERNEL,
"%s%d", "ipmb-",
client->adapter->nr);
+ if (!ipmb_dev->miscdev.name)
+ pr_warn("Failed to allocate mem to miscdev.name\n");
+
ipmb_dev->miscdev.fops = &ipmb_fops;
ipmb_dev->miscdev.parent = &client->dev;
ret = misc_register(&ipmb_dev->miscdev);
--
2.25.1
Powered by blists - more mailing lists