All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/string_helpers: add allocated strarray to device resource.
@ 2022-05-06  2:28 Puyou Lu
  2022-05-06  3:23 ` [PATCH] lib/string_helpers: add allocated strarray to device Puyou Lu
  2022-05-12 20:49 ` [PATCH] lib/string_helpers: add allocated strarray to device resource Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Puyou Lu @ 2022-05-06  2:28 UTC (permalink / raw)
  Cc: puyou.lu, Andy Shevchenko, Andrew Morton, Kees Cook, Petr Mladek,
	Linus Walleij, Guenter Roeck, Chris Down, linux-kernel

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-12 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  2:28 [PATCH] lib/string_helpers: add allocated strarray to device resource Puyou Lu
2022-05-06  3:23 ` [PATCH] lib/string_helpers: add allocated strarray to device Puyou Lu
2022-05-06  4:44   ` [PATCH] lib/string_helpers: add allocated strarray to device's resource list Puyou Lu
2022-05-06  6:43     ` Andy Shevchenko
2022-05-12 20:49 ` [PATCH] lib/string_helpers: add allocated strarray to device resource Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.