[PATCH 2/6] Provide __free(argv) for argv_split() users

From: Masami Hiramatsu (Google)
Date: Fri Jan 03 2025 - 18:02:27 EST


From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>

Provide __free(argv) macro for argv_split() users so that they can
avoid gotos.

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
---
include/linux/string.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/string.h b/include/linux/string.h
index 493ac4862c77..7035a70e30be 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -312,6 +312,8 @@ extern void *kmemdup_array(const void *src, size_t count, size_t element_size, g
extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
extern void argv_free(char **argv);

+DEFINE_FREE(argv, char **, argv_free(_T))
+
/* lib/cmdline.c */
extern int get_option(char **str, int *pint);
extern char *get_options(const char *str, int nints, int *ints);