[PATCH 2/2] lib: zstd: Correct streaming initializer documentation
From: Karl Mehltretter
Date: Sat Sep 19 2026 - 10:35:45 EST
zstd_init_cstream() omits the colon after parameters and uses params
in its workspace sizing example. The example also passes compression
parameters by value instead of by address. zstd_init_dstream()
misspells workspace_size and omits its NULL return on error.
The zstd upgrade also left the behavior descriptions stale: the
compression wrapper converts zero to ZSTD_CONTENTSIZE_UNKNOWN,
regardless of the content-size flag, and the decompression wrapper
ignores max_window_size.
Match the parameter descriptions, workspace example and return
documentation to the streaming initializer wrappers.
Fixes: cf30f6a5f0c6 ("lib: zstd: Add kernel-specific API")
Fixes: e0c1b49f5b67 ("lib: zstd: Upgrade to latest upstream zstd version 1.4.10")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---
include/linux/zstd.h | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/include/linux/zstd.h b/include/linux/zstd.h
index 4f0e2890a5bd..ab6d4d3f815d 100644
--- a/include/linux/zstd.h
+++ b/include/linux/zstd.h
@@ -457,15 +457,12 @@ size_t zstd_cstream_workspace_bound_with_ext_seq_prod(const zstd_compression_par
/**
* zstd_init_cstream() - initialize a zstd streaming compression context
- * @parameters The zstd parameters to use for compression.
- * @pledged_src_size: If params.fParams.contentSizeFlag == 1 then the caller
- * must pass the source size (zero means empty source).
- * Otherwise, the caller may optionally pass the source
- * size, or zero if unknown.
+ * @parameters: The zstd parameters to use for compression.
+ * @pledged_src_size: The source size, or zero if unknown.
* @workspace: The workspace to emplace the context into. It must outlive
* the returned context.
* @workspace_size: The size of workspace.
- * Use zstd_cstream_workspace_bound(params->cparams) to
+ * Use zstd_cstream_workspace_bound(¶meters->cParams) to
* determine how large the workspace must be.
*
* Return: The zstd streaming compression context or NULL on error.
@@ -552,14 +549,14 @@ size_t zstd_dstream_workspace_bound(size_t max_window_size);
/**
* zstd_init_dstream() - initialize a zstd streaming decompression context
- * @max_window_size: The maximum window size allowed for compressed frames.
+ * @max_window_size: Unused. This argument does not limit the frame window size.
* @workspace: The workspace to emplace the context into. It must outlive
* the returned context.
- * @workspaceSize: The size of workspace.
+ * @workspace_size: The size of workspace.
* Use zstd_dstream_workspace_bound(max_window_size) to
* determine how large the workspace must be.
*
- * Return: The zstd streaming decompression context.
+ * Return: The zstd streaming decompression context or NULL on error.
*/
zstd_dstream *zstd_init_dstream(size_t max_window_size, void *workspace,
size_t workspace_size);
--
2.39.5 (Apple Git-154)