[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241202165723.17292-1-brgl@bgdev.pl>
Date: Mon, 2 Dec 2024 17:57:23 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Georgi Djakov <djakov@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Cc: linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: [PATCH] interconnect: icc-clk: check return values of devm_kasprintf()
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
devm_kasprintf() can fail and return NULL, add missing return value
checks.
Fixes: 0ac2a08f42ce ("interconnect: add clk-based icc provider support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
---
drivers/interconnect/icc-clk.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/interconnect/icc-clk.c b/drivers/interconnect/icc-clk.c
index b956e4050f381..88f311c110207 100644
--- a/drivers/interconnect/icc-clk.c
+++ b/drivers/interconnect/icc-clk.c
@@ -116,6 +116,11 @@ struct icc_provider *icc_clk_register(struct device *dev,
}
node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_master", data[i].name);
+ if (!node->name) {
+ ret = -ENOMEM;
+ goto err;
+ }
+
node->data = &qp->clocks[i];
icc_node_add(node, provider);
/* link to the next node, slave */
@@ -129,6 +134,11 @@ struct icc_provider *icc_clk_register(struct device *dev,
}
node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_slave", data[i].name);
+ if (!node->name) {
+ ret = -ENOMEM;
+ goto err;
+ }
+
/* no data for slave node */
icc_node_add(node, provider);
onecell->nodes[j++] = node;
--
2.45.2
Powered by blists - more mailing lists