Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linkdata] [Deepin Kernel SIG] Fix compile errors with clang-19 #493

Merged

Conversation

Avenger-285714
Copy link
Collaborator

No description provided.

Some platforms such as 'x86_64' does not support
'-mno-outline-atomics' option, so add a compiler check before it.

Fix follow error with clang-19:
  clang: error: 'x86_64' does not support '-mno-outline-atomics'; flag ignored [-Werror,-Woption-ignored]

By the way, EXTRA_{A,C,CPP,LD}FLAGS are deprecated and should be
replaced by the new flags added via commit f77bf01 ("kbuild:
introduce ccflags-y, asflags-y and ldflags-y").

Fixes: 6572288 ("deepin: arm: scsi: fix build error of linkdata ps3stor driver")
Signed-off-by: WangYuli <[email protected]>
Fix follow errors:
 error: unknown warning option '-Wmaybe-uninitialized'; did you mean '-Wuninitialized'? [-Werror,-Wunknown-warning-option]

Signed-off-by: WangYuli <[email protected]>
Fix follow compile errors with clang-19:

drivers/net/ethernet/linkdata/sxe/sxepf/sxe_host_cli.c:182:26: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  182 | s32 sxe_cli_cdev_register()
      |                          ^
      |                           void
drivers/net/ethernet/linkdata/sxe/sxepf/sxe_host_cli.c:215:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  215 | void sxe_cli_cdev_unregister()
      |                             ^
      |                              void
2 errors generated.

drivers/net/ethernet/linkdata/sxe/sxepf/sxe_host_hdc.c:137:35: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  137 | struct semaphore *sxe_hdc_sema_get()
      |                                   ^
      |                                    void
1 error generated.

Signed-off-by: WangYuli <[email protected]>
Fix follow error with clang-19:

drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_ring.c:119:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  119 |                 default:
      |                 ^
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_ring.c:119:3: note: insert 'break;' to avoid fall-through
  119 |                 default:
      |                 ^
      |                 break;
1 error generated.

Signed-off-by: WangYuli <[email protected]>
Fix follow compile error with clang-19:

drivers/scsi/linkdata/ps3_mgr_cmd_err.c:133:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  133 |         default:
      |         ^
drivers/scsi/linkdata/ps3_mgr_cmd_err.c:133:2: note: insert 'break;' to avoid fall-through
  133 |         default:
      |         ^
      |         break;
1 error generated.

Signed-off-by: WangYuli <[email protected]>
SXE_VFMAILBOX_VFU is just a bitmask. We need to perform a bitwise
AND operation between this bitmask and the returned register value
to determine if the specific flags are set successfully.

Fix follow error with clang-19:

drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_msg.c:107:30: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
  107 |                 if (sxevf_mbx_reg_read(hw) && SXE_VFMAILBOX_VFU) {
      |                                            ^  ~~~~~~~~~~~~~~~~~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_msg.c:107:30: note: use '&' for a bitwise operation
  107 |                 if (sxevf_mbx_reg_read(hw) && SXE_VFMAILBOX_VFU) {
      |                                            ^~
      |                                            &
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_msg.c:107:30: note: remove constant to silence this warning
  107 |                 if (sxevf_mbx_reg_read(hw) && SXE_VFMAILBOX_VFU) {
      |                                            ^~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: WangYuli <[email protected]>
Fix follow compile errors with clang-19:

drivers/scsi/linkdata/ps3_device_manager_sas.c:234:11: error: explicitly assigning value of variable of type 'struct ps3_instance *' to itself [-Werror,-Wself-assign]
  234 |         instance = instance;
      |         ~~~~~~~~ ^ ~~~~~~~~
1 error generated.

drivers/scsi/linkdata/linux/ps3_cli_debug.c:3609:7: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign]
 3609 |         argc = argc;
      |         ~~~~ ^ ~~~~
drivers/scsi/linkdata/linux/ps3_cli_debug.c:3610:7: error: explicitly assigning value of variable of type 'char **' to itself [-Werror,-Wself-assign]
 3610 |         argv = argv;
      |         ~~~~ ^ ~~~~
2 errors generated.

Signed-off-by: WangYuli <[email protected]>
Fix follow error with clang-19:

drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:73:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
   73 |         if (xdp_rxq_info_reg(&ring->xdp_rxq, adapter->netdev, ring->idx, 0) < 0) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:96:9: note: uninitialized use occurs here
   96 |         return ret;
      |                ^~~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:73:2: note: remove the 'if' if its condition is always false
   73 |         if (xdp_rxq_info_reg(&ring->xdp_rxq, adapter->netdev, ring->idx, 0) < 0) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   74 |                 LOG_ERROR_BDF("ring[%u] xdp rxq info reg failed\n",ring->idx);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   75 |                 goto l_xdp_rxq_reg_failed;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
   76 |         }
      |         ~
drivers/net/ethernet/linkdata/sxevf/sxevf/sxevf_rx_proc.c:35:9: note: initialize the variable 'ret' to silence this warning
   35 |         s32 ret;
      |                ^
      |                 = 0
1 error generated.

Signed-off-by: WangYuli <[email protected]>
Fix follow compile errors with clang-19:

drivers/scsi/linkdata/ps3_sas_transport.c:816:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  816 | S32 ps3_sas_attach_transport()
      |                             ^
      |                              void
drivers/scsi/linkdata/ps3_sas_transport.c:837:31: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  837 | void ps3_sas_release_transport()
      |                               ^
      |                                void
2 errors generated.

Signed-off-by: WangYuli <[email protected]>
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from avenger-285714. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Avenger-285714 Avenger-285714 merged commit 895a1e0 into deepin-community:linux-6.6.y Nov 25, 2024
3 of 5 checks passed
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. Makefile中,移除了-mno-outline-atomics编译选项,需要确认这是否会影响代码的性能或兼容性。
  2. ps3_cli_debug.cps3_sas_transport.c文件中,argcargv参数在函数中没有被使用,应该移除这些未使用的参数。
  3. ps3_sas_node_phy_update函数中,instance参数没有被使用,应该移除这个未使用的参数。
  4. ps3_sas_attach_transportps3_sas_release_transport函数中,函数签名已经添加了void,这是正确的,不需要额外的修改。
  5. ps3_err_fault_strategy_exec函数中,proc_result变量在PS3_FAULT_STRATEGY_RETRY分支后没有使用break语句,可能会导致意外的行为,应该添加break语句。
  6. ps3_sas_smp_handler函数中,jobshost参数没有被使用,应该移除这些未使用的参数。
  7. ps3_sas_smp_handler函数中,sas_function_template结构体中的transport成员没有被使用,应该移除这个未使用的成员。
  8. ps3_sas_smp_handler函数中,sas_function_template结构体中的transport成员没有被使用,应该移除这个未使用的成员。

总的来说,代码的修改是合理的,但是需要确保移除未使用的参数和成员不会影响代码的功能和性能。

@Avenger-285714 Avenger-285714 changed the title [Linkdata] [Deepin Kernel SIG] Fix compile errors with clang-19 AGAIN [Linkdata] [Deepin Kernel SIG] Fix compile errors with clang-19 Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants