kernel: ltq-vmmc: fix compilation warning
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 11 May 2023 10:28:13 +0000 (12:28 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 12 May 2023 01:15:46 +0000 (03:15 +0200)
Fix compilation warning from ret not handled from copy_from_user and
missing fallthrough.
Fix compilation warning:
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_bbd.c: In function 'vmmc_BBD_WhiteListedCmdWr':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_bbd.c:1012:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
 1012 |             if (IFX_TRUE == pCh->pParent->bSlicSupportsIdleMode)
      |                ^
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_bbd.c:1028:7: note: here
 1028 |       case VMMC_WL_SDD_RING_CFG:
      |       ^~~~
cc1: all warnings being treated as errors

/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_ioctl.c: In function 'VMMC_Dev_Spec_Ioctl':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_ioctl.c:111:15: error: ignoring return value of 'copy_from_user' declared with attribute 'warn_unused_result' [-Werror=unused-result]
  111 |               copy_from_user (p_arg, (IFX_uint8_t*)ioarg, sizeof(arg));\
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_ioctl.c:475:7: note: in expansion of macro 'ON_IOCTL'
  475 |       ON_IOCTL((VMMC_CHANNEL *) pLLDummyCh,
      |       ^~~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_ioctl.c:113:15: error: ignoring return value of 'copy_to_user' declared with attribute 'warn_unused_result' [-Werror=unused-result]
  113 |               copy_to_user ((IFX_uint8_t*)ioarg, p_arg, sizeof(arg));\
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-lantiq_xway/drv_vmmc-1.9.0/src/drv_vmmc_ioctl.c:475:7: note: in expansion of macro 'ON_IOCTL'
  475 |       ON_IOCTL((VMMC_CHANNEL *) pLLDummyCh,
      |       ^~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
package/kernel/lantiq/ltq-vmmc/patches/600-fix-compilation-warning-fallthrough.patch [new file with mode: 0644]
package/kernel/lantiq/ltq-vmmc/patches/601-fix-compilation-warning-ret-not-handled.patch [new file with mode: 0644]

diff --git a/package/kernel/lantiq/ltq-vmmc/patches/600-fix-compilation-warning-fallthrough.patch b/package/kernel/lantiq/ltq-vmmc/patches/600-fix-compilation-warning-fallthrough.patch
new file mode 100644 (file)
index 0000000..7282bc4
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/drv_vmmc_bbd.c
++++ b/src/drv_vmmc_bbd.c
+@@ -1025,6 +1025,7 @@ static IFX_int32_t vmmc_BBD_WhiteListedCmdWr(VMMC_CHANNEL *pCh,
+                }
+             }
+          }
++         fallthrough;
+       case VMMC_WL_SDD_RING_CFG:
+       case VMMC_WL_SDD_DCDC_CFG:
+       case VMMC_WL_SDD_MWI_CFG:
diff --git a/package/kernel/lantiq/ltq-vmmc/patches/601-fix-compilation-warning-ret-not-handled.patch b/package/kernel/lantiq/ltq-vmmc/patches/601-fix-compilation-warning-ret-not-handled.patch
new file mode 100644 (file)
index 0000000..da7c1c8
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/src/drv_vmmc_ioctl.c
++++ b/src/drv_vmmc_ioctl.c
+@@ -108,9 +108,11 @@ extern IFX_int32_t VMMC_ChipAccessInit (
+               {\
+               arg* p_arg = VMMC_OS_Malloc (sizeof(arg));\
+               VMMC_ASSERT (p_arg != IFX_NULL);\
+-              copy_from_user (p_arg, (IFX_uint8_t*)ioarg, sizeof(arg));\
++              if (copy_from_user (p_arg, (IFX_uint8_t*)ioarg, sizeof(arg)))\
++                ret = -EFAULT;\
+               ret = func((pContext), p_arg);\
+-              copy_to_user ((IFX_uint8_t*)ioarg, p_arg, sizeof(arg));\
++              if (copy_to_user ((IFX_uint8_t*)ioarg, p_arg, sizeof(arg)))\
++                ret = -EFAULT;\
+               VMMC_OS_Free (p_arg);\
+               }\
+               break