kernel: ltq-deu: fix compilation warning
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 11 May 2023 11:54:01 +0000 (13:54 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 12 May 2023 01:15:47 +0000 (03:15 +0200)
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@gmail.com>
package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c

index c0861a503f68eed8533a63600023de15e899aab3..2aa4b09593578ac8c96a14ae61be7ed211faeac8 100644 (file)
@@ -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];
index 8c12a2607018b3a2bf8951f0b876008b488089c1..953c3feddc723596d93273010212b83d2e5c9e7d 100644 (file)
@@ -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));
index 51782e0b6a4cb00786217eb23b598b8e8a027b8b..ee7e486b565b0b5eb62f67bdf247ac981174ab9c 100644 (file)
@@ -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) {
index 0e860b9ab5082a8002f0a5f5f4f9e5dd58f3551b..76734917d1e64d21182a27c1c080069411b3db1c 100644 (file)
@@ -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;