[PATCH v2] string: Add missing kernel-doc return descriptions

Kriish Sharma posted 1 patch 1 week, 6 days ago
include/linux/string.h | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH v2] string: Add missing kernel-doc return descriptions
Posted by Kriish Sharma 1 week, 6 days ago
While running kernel-doc validation on linux-next, warnings were emitted
for functions in include/linux/string.h due to missing return value
documentation:

    Warning: include/linux/string.h:375 No description found for return value of 'kbasename'
    Warning: include/linux/string.h:560 No description found for return value of 'strstarts'

This patch adds the missing return value descriptions for both functions
and clears the related kernel-doc warnings.

Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com>
---
v2:
  - Drop strends() changes.

v1: https://lore.kernel.org/all/20251118180008.2620929-1-kriish.sharma2006@gmail.com

 include/linux/string.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/string.h b/include/linux/string.h
index 929d05d1247c..0eba937f441c 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -371,6 +371,10 @@ static inline void memzero_explicit(void *s, size_t count)
  * kbasename - return the last part of a pathname.
  *
  * @path: path to extract the filename from.
+ *
+ * Returns:
+ * Pointer to the filename portion inside @path. If no '/' exists,
+ * returns @path unchanged.
  */
 static inline const char *kbasename(const char *path)
 {
@@ -556,6 +560,9 @@ static __always_inline size_t str_has_prefix(const char *str, const char *prefix
  * strstarts - does @str start with @prefix?
  * @str: string to examine
  * @prefix: prefix to look for.
+ *
+ * Returns:
+ * True if @str begins with @prefix. False in all other cases.
  */
 static inline bool strstarts(const char *str, const char *prefix)
 {
-- 
2.34.1
Re: [PATCH v2] string: Add missing kernel-doc return descriptions
Posted by Kees Cook 1 week, 5 days ago
On Tue, 18 Nov 2025 18:48:28 +0000, Kriish Sharma wrote:
> While running kernel-doc validation on linux-next, warnings were emitted
> for functions in include/linux/string.h due to missing return value
> documentation:
> 
>     Warning: include/linux/string.h:375 No description found for return value of 'kbasename'
>     Warning: include/linux/string.h:560 No description found for return value of 'strstarts'
> 
> [...]

Applied to for-next/hardening, thanks!

[1/1] string: Add missing kernel-doc return descriptions
      https://git.kernel.org/kees/c/e17c5b83dec5

Take care,

-- 
Kees Cook
Re: [PATCH v2] string: Add missing kernel-doc return descriptions
Posted by Andy Shevchenko 1 week, 6 days ago
On Tue, Nov 18, 2025 at 8:50 PM Kriish Sharma
<kriish.sharma2006@gmail.com> wrote:
>
> While running kernel-doc validation on linux-next, warnings were emitted
> for functions in include/linux/string.h due to missing return value
> documentation:
>
>     Warning: include/linux/string.h:375 No description found for return value of 'kbasename'
>     Warning: include/linux/string.h:560 No description found for return value of 'strstarts'
>
> This patch adds the missing return value descriptions for both functions
> and clears the related kernel-doc warnings.

Reviewed-by: Andy Shevchenko <andy@kernel.org>

...

>   * kbasename - return the last part of a pathname.
>   *

This blank line can be removed, while at it, but I leave it to you and
maintainers.

>   * @path: path to extract the filename from.

-- 
With Best Regards,
Andy Shevchenko