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

[WIP] [Deepin Kernel SIG] Fix errors with clang-19 #499

Closed

Conversation

Avenger-285714
Copy link
Collaborator

No description provided.

Fix follow error with clang-19:

drivers/pwm/pwm-phytium.c:233:2: error: variable 'dbcly' is uninitialized when used here [-Werror,-Wuninitialized]
  233 |         dbcly &= 0x0;
      |         ^~~~~
drivers/pwm/pwm-phytium.c:226:11: note: initialize the variable 'dbcly' to silence this warning
  226 |         u64 dbcly, cycles, upcycles, dwcycles;
      |                  ^
      |                   = 0
1 error generated.

Signed-off-by: WangYuli <[email protected]>
…lang

Fix follow errors with clang-19:

sound/soc/phytium/phytium_i2s.c:979:18: error: variable 'bus_widths' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
  979 | static const u32 bus_widths[COMP_MAX_DATA_WIDTH] = {
      |                  ^~~~~~~~~~
sound/soc/phytium/phytium_i2s.c:987:18: error: variable 'formats' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
  987 | static const u32 formats[COMP_MAX_WORDSIZE] = {
      |                  ^~~~~~~
2 errors generated.

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

drivers/i3c/master/i3c-master-phytium.c:1710:7: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
 1710 |                 if (!master->prescl0)
      |                     ^~~~~~~~~~~~~~~~
drivers/i3c/master/i3c-master-phytium.c:1788:9: note: uninitialized use occurs here
 1788 |         return ret;
      |                ^~~
drivers/i3c/master/i3c-master-phytium.c:1710:3: note: remove the 'if' if its condition is always false
 1710 |                 if (!master->prescl0)
      |                 ^~~~~~~~~~~~~~~~~~~~~
 1711 |                         goto err_disable_sysclk;
      |                         ~~~~~~~~~~~~~~~~~~~~~~~
drivers/i3c/master/i3c-master-phytium.c:1669:9: note: initialize the variable 'ret' to silence this warning
 1669 |         int ret, irq;
      |                ^
      |                 = 0
1 error 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

According to KVM documention for LoongArch, 'v0' should be 'a0'.
And 'a0' has been there upstream.

Fix follow compile errors with clang-19:

In file included from ./include/uapi/linux/kvm_para.h:41:
./arch/loongarch/include/asm/kvm_para.h:44:24: error: unknown register name 'v0' in asm
   44 |         register long ret asm("v0");
      |                               ^
./arch/loongarch/include/asm/kvm_para.h:59:24: error: unknown register name 'v0' in asm
   59 |         register long ret asm("v0");
      |                               ^
./arch/loongarch/include/asm/kvm_para.h:76:24: error: unknown register name 'v0' in asm
   76 |         register long ret asm("v0");
      |                               ^
./arch/loongarch/include/asm/kvm_para.h:94:24: error: unknown register name 'v0' in asm
   94 |         register long ret asm("v0");
      |                               ^
./arch/loongarch/include/asm/kvm_para.h:114:24: error: unknown register name 'v0' in asm
  114 |         register long ret asm("v0");
      |                               ^
./arch/loongarch/include/asm/kvm_para.h:135:24: error: unknown register name 'v0' in asm
  135 |         register long ret asm("v0");
      |                               ^
6 errors generated.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e33bda7ee50c3c20d80f5ca6dc5ca2cd37863518
Signed-off-by: Mingcong Bai <[email protected]>
Signed-off-by: WangYuli <[email protected]>
Fix follow error with clang-19:

arch/loongarch/kernel/legacy_boot.c:687:28: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  687 | void __init acpi_arch_init (){
      |                            ^
      |                             void
1 error generated.

Signed-off-by: WangYuli <[email protected]>
@Avenger-285714 Avenger-285714 changed the title [WIP] [Phytium] [Deepin Kernel SIG] Fix errors with clang-19 [WIP] [Deepin Kernel SIG] Fix errors with clang-19 Nov 27, 2024
Fix follow compile errors with clang-19:

drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-desc.c:478:14: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign]
  478 |         start_index = start_index;
      |         ~~~~~~~~~~~ ^ ~~~~~~~~~~~
1 error generated.

drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:497:8: error: explicitly assigning value of variable of type 'struct fxgmac_pdata *' to itself [-Werror,-Wself-assign]
  497 |         pdata = pdata;
      |         ~~~~~ ^ ~~~~~
drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:623:8: error: explicitly assigning value of variable of type 'struct fxgmac_pdata *' to itself [-Werror,-Wself-assign]
  623 |         pdata = pdata;
      |         ~~~~~ ^ ~~~~~
drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:1232:8: error: explicitly assigning value of variable of type 'struct fxgmac_pdata *' to itself [-Werror,-Wself-assign]
 1232 |         pdata = pdata;
      |         ~~~~~ ^ ~~~~~
drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:2321:7: error: explicitly assigning value of variable of type 'unsigned int' to itself [-Werror,-Wself-assign]
 2321 |         type = type;
      |         ~~~~ ^ ~~~~
drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:4566:9: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign]
 4566 |         int_id = int_id;
      |         ~~~~~~ ^ ~~~~~~
drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:4888:8: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign]
 4888 |         speed = speed;
      |         ~~~~~ ^ ~~~~~
6 errors generated.

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

deepin pr auto review

代码审查意见:

  1. kvm_hypercall等函数中,寄存器ret的asm约束从v0更改为a0,这可能会影响函数的返回值寄存器。需要确认这是否符合LoongArch架构的调用约定。

  2. phytium_i3c_master_probe函数中,变量ret的初始值被设置为-EINVAL,但在函数中并没有使用这个初始值。如果这个变量没有被使用,应该移除它以避免混淆。

  3. fxgmac_tx_desc_init_channel函数中,start_index被赋值后又被赋值为自身,这个操作没有实际意义,应该移除。

  4. fxgmac_set_mac_hash_table函数中,pdatachannel在函数中没有被使用,应该移除这些未使用的变量。

  5. fxgmac_prepare_tx_stop函数中,speed变量在函数中被声明但未使用,应该移除这个未使用的变量。

  6. phytium_configure_daiphytium_configure_dai_by_dt函数中,formatsbus_widths数组在函数中被声明但未使用,应该移除这些未使用的数组。

  7. phytium_configure_dai_by_dt函数中,idxidx2变量在函数中被声明但未使用,应该移除这些未使用的变量。

  8. phytium_pwm_set_dbcly函数中,dbcly变量被初始化为0,但在函数中并没有使用这个初始值。如果这个变量没有被使用,应该移除它以避免混淆。

以上是代码审查的初步意见,需要进一步确认这些更改是否符合LoongArch架构的调用约定和代码风格规范。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants