[openwrt/openwrt] kernel: ltq-deu: fix compilation warning

LEDE Commits lede-commits at lists.infradead.org
Thu May 11 18:25:29 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/5ca3386c8a156f0feb659bacffd88306a82f5545

commit 5ca3386c8a156f0feb659bacffd88306a82f5545
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Thu May 11 13:54:01 2023 +0200

    kernel: ltq-deu: fix compilation warning
    
    Fix compilation warning for fallthrough and unused variables.
    Fix compilation warning:
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_des.c: In function 'ifx_deu_des':
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_des.c:206:35: error: this statement may fall through [-Werror=implicit-fallthrough=]
      206 |                         des->K3LR = DEU_ENDIAN_SWAP(*((u32 *) key + 5));
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_des.c:209:17: note: here
      209 |                 case 16:
          |                 ^~~~
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_des.c:211:35: error: this statement may fall through [-Werror=implicit-fallthrough=]
      211 |                         des->K2LR = DEU_ENDIAN_SWAP(*((u32 *) key + 3));
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_des.c:214:17: note: here
      214 |                 case 8:
          |                 ^~~~
    cc1: all warnings being treated as errors
    
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_aes.c: In function 'ifx_deu_aes':
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_aes.c:260:21: error: unused variable 'ctx' [-Werror=unused-variable]
      260 |     struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg;
          |                     ^~~
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_aes.c: In function 'ifx_deu_aes_xts':
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_aes.c:702:21: error: unused variable 'ctx' [-Werror=unused-variable]
      702 |     struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg;
          |                     ^~~
    cc1: all warnings being treated as errors
    
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_sha1.c: In function 'sha1_final':
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_sha1.c:203:19: error: unused variable 'flag' [-Werror=unused-variable]
      203 |     unsigned long flag;
          |                   ^~~~
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_sha1.c:202:33: error: unused variable 'hashs' [-Werror=unused-variable]
      202 |     volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START;
          |                                 ^~~~~
    cc1: all warnings being treated as errors
    
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_md5.c: In function 'md5_init':
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_md5.c:146:33: error: unused variable 'hash' [-Werror=unused-variable]
      146 |     volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START;
          |                                 ^~~~
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_md5.c: In function 'md5_final':
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_md5.c:204:19: error: unused variable 'flag' [-Werror=unused-variable]
      204 |     unsigned long flag;
          |                   ^~~~
    /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/ltq-deu-danube/ltq-deu/ifxmips_md5.c:203:33: error: unused variable 'hashs' [-Werror=unused-variable]
      203 |     volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START;
          |                                 ^~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c  | 4 ++--
 package/kernel/lantiq/ltq-deu/src/ifxmips_des.c  | 3 ++-
 package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c  | 6 +++---
 package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c | 4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
index c0861a503f..2aa4b09593 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
@@ -257,7 +257,7 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
 {
     /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
     volatile struct aes_t *aes = (volatile struct aes_t *) AES_START;
-    struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg;
+    //struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg;
     unsigned long flag;
     /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
     int i = 0;
@@ -699,7 +699,7 @@ void ifx_deu_aes_xts (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
 {
     /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
     volatile struct aes_t *aes = (volatile struct aes_t *) AES_START;
-    struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg;
+    //struct aes_ctx *ctx = (struct aes_ctx *)ctx_arg;
     unsigned long flag;
     /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
     u8 oldiv[16];
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
index 8c12a26070..953c3feddc 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
@@ -205,12 +205,13 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
                         des->K3HR = DEU_ENDIAN_SWAP(*((u32 *) key + 4));
                         des->K3LR = DEU_ENDIAN_SWAP(*((u32 *) key + 5));
                         /* no break; */
-
+                        fallthrough;
                 case 16:
                         des->K2HR = DEU_ENDIAN_SWAP(*((u32 *) key + 2));
                         des->K2LR = DEU_ENDIAN_SWAP(*((u32 *) key + 3));
 
                         /* no break; */
+                        fallthrough;
                 case 8:
                         des->K1HR = DEU_ENDIAN_SWAP(*((u32 *) key + 0));
                         des->K1LR = DEU_ENDIAN_SWAP(*((u32 *) key + 1));
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
index 51782e0b6a..ee7e486b56 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
@@ -143,7 +143,7 @@ static inline void md5_transform_helper(struct md5_ctx *ctx)
 static int md5_init(struct shash_desc *desc)
 {
     struct md5_ctx *mctx = shash_desc_ctx(desc);
-    volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START;
+    //volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START;
 
     mctx->byte_count = 0;
     mctx->started = 0;
@@ -200,8 +200,8 @@ static int md5_final(struct shash_desc *desc, u8 *out)
     const unsigned int offset = mctx->byte_count & 0x3f;
     char *p = (char *)mctx->block + offset;
     int padding = 56 - (offset + 1);
-    volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START;
-    unsigned long flag;
+    //volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START;
+    //unsigned long flag;
 
     *p++ = 0x80;
     if (padding < 0) {
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
index 0e860b9ab5..76734917d1 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
@@ -199,8 +199,8 @@ static int sha1_final(struct shash_desc *desc, u8 *out)
     u64 t;
     u8 bits[8] = { 0, };
     static const u8 padding[64] = { 0x80, };
-    volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START;
-    unsigned long flag;
+    //volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START;
+    //unsigned long flag;
 
     t = sctx->count;
     bits[7] = 0xff & t;




More information about the lede-commits mailing list