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

Puyou Lu
2022-05-06T02:28:58Z

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

Signed-off-by: Puyou Lu <puyou.lu@gmail.com>
---
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