Linux driver-core infrastructure
 help / color / mirror / Atom feed
* [PATCH v2] devres: fix kernel-doc of the variadic devm_kmalloc_obj*() macros
@ 2026-12-03 14:12 Yashvardhan Saraf via B4 Relay
  2026-12-04  7:41 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Yashvardhan Saraf via B4 Relay @ 2026-12-03 14:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Johan Hovold
  Cc: Randy Dunlap, driver-core, Yashvardhan Saraf

From: Yashvardhan Saraf <bobmcd@tuta.io>

devm_kmalloc_obj(), devm_kmalloc_objs() and devm_kmalloc_flex() take
their optional GFP flags through a variadic "..." parameter, but their
kernel-doc comments document it as "@GFP". scripts/kernel-doc therefore
warns:

  Excess function parameter 'GFP' description in 'devm_kmalloc_obj'
  Excess function parameter 'GFP' description in 'devm_kmalloc_objs'
  Excess function parameter 'GFP' description in 'devm_kmalloc_flex'

and the optional argument is missing from the generated documentation.
Use "@...:" as include/linux/slab.h already does for kmalloc_obj() and
friends.

Documentation only, no functional change.

This issue was found with scripts/kernel-doc by an AI coding assistant
(Claude Opus 5.5), which also drafted this patch. It has been checked
with scripts/kernel-doc -none -Wall (the three warnings are gone), and
drivers/base/devres.o, which includes the header, was compile-tested
with W=1 and smatch on x86_64 allmodconfig without new warnings. Not
runtime-tested (documentation-only change).

Fixes: 29a86e8818a8 ("devres: Provide kmalloc_obj*-style API for devm_kmalloc")
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Yashvardhan Saraf <bobmcd@tuta.io>
---
Changes in v2:
- Use my full name in the Signed-off-by line (Randy).
- Add Randy's Acked-by and Tested-by. No code change.
- Link to v1: https://patch.msgid.link/20261203-fix-h3-devres-kmalloc-obj-doc-v1-1-7a9e351811df@tuta.io
---
 include/linux/device/devres.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/device/devres.h b/include/linux/device/devres.h
index 7656c9ecd4da..a17077e07590 100644
--- a/include/linux/device/devres.h
+++ b/include/linux/device/devres.h
@@ -87,7 +87,7 @@ static inline void *devm_kcalloc(struct device *dev, size_t n, size_t size, gfp_
  * devm_kmalloc_obj - Device-managed allocation of a single typed object
  * @DEV: Device to scope the allocation lifetime to.
  * @VAR_OR_TYPE: Variable or type to allocate.
- * @GFP: Optional GFP flags (defaults to %GFP_KERNEL).
+ * @...: Optional GFP flags (defaults to %GFP_KERNEL).
  *
  * Device-managed counterpart of kmalloc_obj(): the allocation is sized from
  * @VAR_OR_TYPE and returned as a pointer to that type, not void *.
@@ -104,7 +104,7 @@ static inline void *devm_kcalloc(struct device *dev, size_t n, size_t size, gfp_
  * @DEV: Device to scope the allocation lifetime to.
  * @VAR_OR_TYPE: Variable or type to allocate an array of.
  * @COUNT: How many elements in the array.
- * @GFP: Optional GFP flags (defaults to %GFP_KERNEL).
+ * @...: Optional GFP flags (defaults to %GFP_KERNEL).
  *
  * Returns: newly allocated pointer to an array of @VAR_OR_TYPE on success, or
  * NULL on failure (including when the total size overflows).
@@ -144,7 +144,7 @@ static inline void *devm_kcalloc(struct device *dev, size_t n, size_t size, gfp_
  * @VAR_OR_TYPE: Variable or type to allocate (with its flexible array).
  * @FAM: The name of the flexible array member of the structure.
  * @COUNT: How many flexible array member elements to allocate.
- * @GFP: Optional GFP flags (defaults to %GFP_KERNEL).
+ * @...: Optional GFP flags (defaults to %GFP_KERNEL).
  *
  * Returns: newly allocated pointer to @VAR_OR_TYPE on success, or NULL on
  * failure. If @FAM has been annotated with __counted_by(), its counter is set

---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
change-id: 20261203-fix-h3-devres-kmalloc-obj-doc-b27ff58bb814

Best regards,
--  
Yashvardhan Saraf <bobmcd@tuta.io>



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

* Re: [PATCH v2] devres: fix kernel-doc of the variadic devm_kmalloc_obj*() macros
  2026-12-03 14:12 [PATCH v2] devres: fix kernel-doc of the variadic devm_kmalloc_obj*() macros Yashvardhan Saraf via B4 Relay
@ 2026-12-04  7:41 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2026-12-04  7:41 UTC (permalink / raw)
  To: bobmcd
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Randy Dunlap, driver-core

On Thu, Dec 03, 2026 at 07:42:39PM +0530, Yashvardhan Saraf via B4 Relay wrote:
> From: Yashvardhan Saraf <bobmcd@tuta.io>
> 
> devm_kmalloc_obj(), devm_kmalloc_objs() and devm_kmalloc_flex() take
> their optional GFP flags through a variadic "..." parameter, but their
> kernel-doc comments document it as "@GFP". scripts/kernel-doc therefore
> warns:
> 
>   Excess function parameter 'GFP' description in 'devm_kmalloc_obj'
>   Excess function parameter 'GFP' description in 'devm_kmalloc_objs'
>   Excess function parameter 'GFP' description in 'devm_kmalloc_flex'
> 
> and the optional argument is missing from the generated documentation.
> Use "@...:" as include/linux/slab.h already does for kmalloc_obj() and
> friends.
> 
> Documentation only, no functional change.
 
> This issue was found with scripts/kernel-doc by an AI coding assistant
> (Claude Opus 5.5), which also drafted this patch. It has been checked
> with scripts/kernel-doc -none -Wall (the three warnings are gone), and
> drivers/base/devres.o, which includes the header, was compile-tested
> with W=1 and smatch on x86_64 allmodconfig without new warnings. Not
> runtime-tested (documentation-only change).

I dropped this paragraph when applying (such information can go below
the --- line).

> Fixes: 29a86e8818a8 ("devres: Provide kmalloc_obj*-style API for devm_kmalloc")
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> Tested-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Yashvardhan Saraf <bobmcd@tuta.io>
> ---
> Changes in v2:
> - Use my full name in the Signed-off-by line (Randy).
> - Add Randy's Acked-by and Tested-by. No code change.
> - Link to v1: https://patch.msgid.link/20261203-fix-h3-devres-kmalloc-obj-doc-v1-1-7a9e351811df@tuta.io

Applied to driver-core-testing for 7.5, thanks.

Johan

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

end of thread, other threads:[~2026-12-04  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 14:12 [PATCH v2] devres: fix kernel-doc of the variadic devm_kmalloc_obj*() macros Yashvardhan Saraf via B4 Relay
2026-12-04  7:41 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox