[PATCH] PM / OPP: Handle return value of kasprintf
From: Arvind Yadav
Date: Wed Sep 20 2017 - 03:00:18 EST
kasprintf() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
drivers/base/power/opp/debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
index 81cf120..226d6ae 100644
--- a/drivers/base/power/opp/debugfs.c
+++ b/drivers/base/power/opp/debugfs.c
@@ -45,7 +45,8 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
for (i = 0; i < opp_table->regulator_count; i++) {
name = kasprintf(GFP_KERNEL, "supply-%d", i);
-
+ if (!name)
+ return false;
/* Create per-opp directory */
d = debugfs_create_dir(name, pdentry);
--
1.9.1