[PATCH] lib/string_helpers: add allocated strarray to device resource.

From: Puyou Lu
Date: Thu May 05 2022 - 22:28:58 EST


This is a must to automatically release strarray when the device
disappears.

Signed-off-by: Puyou Lu <puyou.lu@xxxxxxxxx>
---
lib/string_helpers.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 4f877e9551d5..b4497c068172 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -757,6 +757,7 @@ char **devm_kasprintf_strarray(struct device *dev, const char *prefix, size_t n)
return ERR_PTR(-ENOMEM);
}

+ devres_add(dev, ptr);
return ptr->array;
}
EXPORT_SYMBOL_GPL(devm_kasprintf_strarray);
--
2.17.1