Skip to contentSkip to conversation

lib: zstd: remove unneeded variable

PATCH In review [email protected] 2 participants 2 messages Jun 14, 2023 – Oct 12, 2023 1 message not in the archive Zstd

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 lib: zstd: remove unneeded variable

fix the following coccicheck warning:

lib/zstd/compress/zstd_cwksp.h:220:17-27: Unneeded variable: "slackSpace". Return "ZSTD_CWKSP_ALIGNMENT_BYTES".

---
 lib/zstd/compress/zstd_cwksp.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/zstd/compress/zstd_cwksp.h +0 -0
index 349fc923c355..36c574cd3d6f 100644
@@ -217,8 +217,7 @@ MEM_STATIC size_t ZSTD_cwksp_slack_space_required(void) {
      * n_1 + n_2 == 64 bytes if the cwksp is freshly allocated, due to 

tables and
* aligneds being sized in multiples of 64 bytes. */

-    size_t const slackSpace = ZSTD_CWKSP_ALIGNMENT_BYTES;
-    return slackSpace;
+    return ZSTD_CWKSP_ALIGNMENT_BYTES;

}

#2 lore raw
Quoted 12 lines · On Jun 14, 2023, at 3:14 AM, [email protected] wrote:

!-------------------------------------------------------------------| This Message Is From an Untrusted Sender
You have not previously corresponded with this sender. |-------------------------------------------------------------------!

fix the following coccicheck warning:

lib/zstd/compress/zstd_cwksp.h:220:17-27: Unneeded variable: "slackSpace". Return "ZSTD_CWKSP_ALIGNMENT_BYTES".

If you would like to fix this, please fix this upstream at https://github.com/facebook/zstd.
That will get synced to the kernel on the next update.

Thanks,
Nick Terrell

Quoted 17 lines

---
lib/zstd/compress/zstd_cwksp.h | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
lib/zstd/compress/zstd_cwksp.h +1 -2
index 349fc923c355..36c574cd3d6f 100644
@@ -217,8 +217,7 @@ MEM_STATIC size_t ZSTD_cwksp_slack_space_required(void) {
     * n_1 + n_2 == 64 bytes if the cwksp is freshly allocated, due to tables and
     * aligneds being sized in multiples of 64 bytes.
     */
-    size_t const slackSpace = ZSTD_CWKSP_ALIGNMENT_BYTES;
-    return slackSpace;
+    return ZSTD_CWKSP_ALIGNMENT_BYTES;
 }