lib/zlib: remove redundation assignement of avail_in dfltcc_gdht()

Message ID 20230128165048.1245792-1-trix@redhat.com
State New
Headers
Series lib/zlib: remove redundation assignement of avail_in dfltcc_gdht() |

Commit Message

Tom Rix Jan. 28, 2023, 4:50 p.m. UTC
  cppcheck reports
lib/zlib_dfltcc/dfltcc_deflate.c:65:21: warning: Redundant assignment of 'avail_in' to itself. [selfAssignment]
    size_t avail_in = avail_in = strm->avail_in;

Only setting avail_in once is needed.

Fixes: aa5b395b69b6 ("lib/zlib: add s390 hardware support for kernel zlib_deflate")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 lib/zlib_dfltcc/dfltcc_deflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ilya Leoshkevich Jan. 29, 2023, 7:07 p.m. UTC | #1
On Sat, 2023-01-28 at 08:50 -0800, Tom Rix wrote:
> cppcheck reports
> lib/zlib_dfltcc/dfltcc_deflate.c:65:21: warning: Redundant assignment
> of 'avail_in' to itself. [selfAssignment]
>     size_t avail_in = avail_in = strm->avail_in;
> 
> Only setting avail_in once is needed.
> 
> Fixes: aa5b395b69b6 ("lib/zlib: add s390 hardware support for kernel
> zlib_deflate")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  lib/zlib_dfltcc/dfltcc_deflate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/zlib_dfltcc/dfltcc_deflate.c
> b/lib/zlib_dfltcc/dfltcc_deflate.c
> index 80924f067c24..b732b6d9e35d 100644
> --- a/lib/zlib_dfltcc/dfltcc_deflate.c
> +++ b/lib/zlib_dfltcc/dfltcc_deflate.c
> @@ -62,7 +62,7 @@ static void dfltcc_gdht(
>  {
>      deflate_state *state = (deflate_state *)strm->state;
>      struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param;
> -    size_t avail_in = avail_in = strm->avail_in;
> +    size_t avail_in = strm->avail_in;
>  
>      dfltcc(DFLTCC_GDHT,
>             param, NULL, NULL,

Thanks for spotting this!

Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
  
Zaslonko Mikhail Jan. 30, 2023, 9:29 a.m. UTC | #2
On 28.01.2023 17:50, Tom Rix wrote:
> cppcheck reports
> lib/zlib_dfltcc/dfltcc_deflate.c:65:21: warning: Redundant assignment of 'avail_in' to itself. [selfAssignment]
>     size_t avail_in = avail_in = strm->avail_in;
> 
> Only setting avail_in once is needed.
> 
> Fixes: aa5b395b69b6 ("lib/zlib: add s390 hardware support for kernel zlib_deflate")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  lib/zlib_dfltcc/dfltcc_deflate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/zlib_dfltcc/dfltcc_deflate.c b/lib/zlib_dfltcc/dfltcc_deflate.c
> index 80924f067c24..b732b6d9e35d 100644
> --- a/lib/zlib_dfltcc/dfltcc_deflate.c
> +++ b/lib/zlib_dfltcc/dfltcc_deflate.c
> @@ -62,7 +62,7 @@ static void dfltcc_gdht(
>  {
>      deflate_state *state = (deflate_state *)strm->state;
>      struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param;
> -    size_t avail_in = avail_in = strm->avail_in;
> +    size_t avail_in = strm->avail_in;
>  
>      dfltcc(DFLTCC_GDHT,
>             param, NULL, NULL,

Acked-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
  

Patch

diff --git a/lib/zlib_dfltcc/dfltcc_deflate.c b/lib/zlib_dfltcc/dfltcc_deflate.c
index 80924f067c24..b732b6d9e35d 100644
--- a/lib/zlib_dfltcc/dfltcc_deflate.c
+++ b/lib/zlib_dfltcc/dfltcc_deflate.c
@@ -62,7 +62,7 @@  static void dfltcc_gdht(
 {
     deflate_state *state = (deflate_state *)strm->state;
     struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param;
-    size_t avail_in = avail_in = strm->avail_in;
+    size_t avail_in = strm->avail_in;
 
     dfltcc(DFLTCC_GDHT,
            param, NULL, NULL,