[rmk-arm:zii 88/102] drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: error: variable 'err' is used uninitialized whenever 'if' condition is false
by kernel test robot
tree: git://git.armlinux.org.uk/~rmk/linux-arm zii
head: 2f38af1897a020adf10ab01d8dc20ea8388b564d
commit: b53990e2eebb53cba059843e3c6e93b3b0c10c59 [88/102] net: dsa: mv88e6xxx: convert 88e6352 to phylink_pcs *EXPERIMENTAL*
config: arm-buildonly-randconfig-r002-20211112 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dddeeafb529e769cde87bd29ef6271ac6bfa5c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
git remote add rmk-arm git://git.armlinux.org.uk/~rmk/linux-arm
git fetch --no-tags rmk-arm zii
git checkout b53990e2eebb53cba059843e3c6e93b3b0c10c59
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (oldpage >= 0)
^~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:120:53: note: uninitialized use occurs here
return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
^~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:116:2: note: remove the 'if' if its condition is always true
if (oldpage >= 0)
^~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:113:18: note: initialize the variable 'err' to silence this warning
int oldpage, err;
^
= 0
drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (oldpage >= 0)
^~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:193:53: note: uninitialized use occurs here
return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
^~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:189:2: note: remove the 'if' if its condition is always true
if (oldpage >= 0)
^~~~~~~~~~~~~~~~~
drivers/net/dsa/mv88e6xxx/serdes-6352.c:182:23: note: initialize the variable 'err' to silence this warning
int oldpage, adv, err;
^
= 0
2 errors generated.
vim +116 drivers/net/dsa/mv88e6xxx/serdes-6352.c
109
110 static int marvell_c22_pcs_modify(struct marvell_c22_pcs *mpcs, u8 reg,
111 u16 mask, u16 val)
112 {
113 int oldpage, err;
114
115 oldpage = marvell_c22_pcs_set_fiber_page(mpcs);
> 116 if (oldpage >= 0)
117 err = __mdiobus_modify(mpcs->mdio.bus, mpcs->mdio.addr,
118 reg, mask, val);
119
120 return marvell_c22_pcs_restore_page(mpcs, oldpage, err);
121 }
122
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
[android-common:android-4.19-stable 14965/24076] kernel/sched/stubs.c:8:5: warning: no previous prototype for 'sched_isolate_cpu'
by kernel test robot
tree: https://android.googlesource.com/kernel/common android-4.19-stable
head: a513b1ef96dcd295f77365400c8574d930c7662e
commit: eead51495c8760858c32d9ad0332ffc94397aa82 [14965/24076] ANDROID: GKI: sched: stub sched_isolate symbols
config: i386-randconfig-r036-20210929 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-4.19-stable
git checkout eead51495c8760858c32d9ad0332ffc94397aa82
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> kernel/sched/stubs.c:8:5: warning: no previous prototype for 'sched_isolate_cpu' [-Wmissing-prototypes]
8 | int sched_isolate_cpu(int cpu)
| ^~~~~~~~~~~~~~~~~
>> kernel/sched/stubs.c:14:5: warning: no previous prototype for 'sched_unisolate_cpu_unlocked' [-Wmissing-prototypes]
14 | int sched_unisolate_cpu_unlocked(int cpu)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/sched/stubs.c:20:5: warning: no previous prototype for 'sched_unisolate_cpu' [-Wmissing-prototypes]
20 | int sched_unisolate_cpu(int cpu)
| ^~~~~~~~~~~~~~~~~~~
>> kernel/sched/stubs.c:26:5: warning: no previous prototype for 'set_task_boost' [-Wmissing-prototypes]
26 | int set_task_boost(int boost, u64 period)
| ^~~~~~~~~~~~~~
vim +/sched_isolate_cpu +8 kernel/sched/stubs.c
7
> 8 int sched_isolate_cpu(int cpu)
9 {
10 return -EINVAL;
11 }
12 EXPORT_SYMBOL_GPL(sched_isolate_cpu);
13
> 14 int sched_unisolate_cpu_unlocked(int cpu)
15 {
16 return -EINVAL;
17 }
18 EXPORT_SYMBOL_GPL(sched_unisolate_cpu_unlocked);
19
> 20 int sched_unisolate_cpu(int cpu)
21 {
22 return -EINVAL;
23 }
24 EXPORT_SYMBOL_GPL(sched_unisolate_cpu);
25
> 26 int set_task_boost(int boost, u64 period)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
arch/mips/kvm/vz.c:1552: warning: expecting prototype for kvm_trap_vz_handle_cop_unusuable(). Prototype was for kvm_trap_vz_handle_cop_unusable() instead
by kernel test robot
Hi Thomas,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5833291ab6de9c3e2374336b51c814e515e8f3a5
commit: 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64 MIPS: Remove KVM_TE support
date: 8 months ago
config: mips-randconfig-r003-20211015 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 45c7e8af4a5e3f0bea4ac209eea34118dd57ac64
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/kvm/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
arch/mips/kvm/vz.c:471: warning: Function parameter or member 'out_compare' not described in '_kvm_vz_save_htimer'
arch/mips/kvm/vz.c:471: warning: Function parameter or member 'out_cause' not described in '_kvm_vz_save_htimer'
arch/mips/kvm/vz.c:471: warning: Excess function parameter 'compare' description in '_kvm_vz_save_htimer'
arch/mips/kvm/vz.c:471: warning: Excess function parameter 'cause' description in '_kvm_vz_save_htimer'
>> arch/mips/kvm/vz.c:1552: warning: expecting prototype for kvm_trap_vz_handle_cop_unusuable(). Prototype was for kvm_trap_vz_handle_cop_unusable() instead
vim +1552 arch/mips/kvm/vz.c
c992a4f6a9b0a3 James Hogan 2017-03-14 1543
c992a4f6a9b0a3 James Hogan 2017-03-14 1544 /**
c992a4f6a9b0a3 James Hogan 2017-03-14 1545 * kvm_trap_vz_handle_cop_unusuable() - Guest used unusable coprocessor.
c992a4f6a9b0a3 James Hogan 2017-03-14 1546 * @vcpu: Virtual CPU context.
c992a4f6a9b0a3 James Hogan 2017-03-14 1547 *
c992a4f6a9b0a3 James Hogan 2017-03-14 1548 * Handle when the guest attempts to use a coprocessor which hasn't been allowed
c992a4f6a9b0a3 James Hogan 2017-03-14 1549 * by the root context.
c992a4f6a9b0a3 James Hogan 2017-03-14 1550 */
c992a4f6a9b0a3 James Hogan 2017-03-14 1551 static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu)
c992a4f6a9b0a3 James Hogan 2017-03-14 @1552 {
c992a4f6a9b0a3 James Hogan 2017-03-14 1553 u32 cause = vcpu->arch.host_cp0_cause;
c992a4f6a9b0a3 James Hogan 2017-03-14 1554 enum emulation_result er = EMULATE_FAIL;
c992a4f6a9b0a3 James Hogan 2017-03-14 1555 int ret = RESUME_GUEST;
c992a4f6a9b0a3 James Hogan 2017-03-14 1556
c992a4f6a9b0a3 James Hogan 2017-03-14 1557 if (((cause & CAUSEF_CE) >> CAUSEB_CE) == 1) {
c992a4f6a9b0a3 James Hogan 2017-03-14 1558 /*
c992a4f6a9b0a3 James Hogan 2017-03-14 1559 * If guest FPU not present, the FPU operation should have been
c992a4f6a9b0a3 James Hogan 2017-03-14 1560 * treated as a reserved instruction!
c992a4f6a9b0a3 James Hogan 2017-03-14 1561 * If FPU already in use, we shouldn't get this at all.
c992a4f6a9b0a3 James Hogan 2017-03-14 1562 */
c992a4f6a9b0a3 James Hogan 2017-03-14 1563 if (WARN_ON(!kvm_mips_guest_has_fpu(&vcpu->arch) ||
c992a4f6a9b0a3 James Hogan 2017-03-14 1564 vcpu->arch.aux_inuse & KVM_MIPS_AUX_FPU)) {
c992a4f6a9b0a3 James Hogan 2017-03-14 1565 preempt_enable();
c992a4f6a9b0a3 James Hogan 2017-03-14 1566 return EMULATE_FAIL;
c992a4f6a9b0a3 James Hogan 2017-03-14 1567 }
c992a4f6a9b0a3 James Hogan 2017-03-14 1568
c992a4f6a9b0a3 James Hogan 2017-03-14 1569 kvm_own_fpu(vcpu);
c992a4f6a9b0a3 James Hogan 2017-03-14 1570 er = EMULATE_DONE;
c992a4f6a9b0a3 James Hogan 2017-03-14 1571 }
c992a4f6a9b0a3 James Hogan 2017-03-14 1572 /* other coprocessors not handled */
c992a4f6a9b0a3 James Hogan 2017-03-14 1573
c992a4f6a9b0a3 James Hogan 2017-03-14 1574 switch (er) {
c992a4f6a9b0a3 James Hogan 2017-03-14 1575 case EMULATE_DONE:
c992a4f6a9b0a3 James Hogan 2017-03-14 1576 ret = RESUME_GUEST;
c992a4f6a9b0a3 James Hogan 2017-03-14 1577 break;
c992a4f6a9b0a3 James Hogan 2017-03-14 1578
c992a4f6a9b0a3 James Hogan 2017-03-14 1579 case EMULATE_FAIL:
c34b26b98caca4 Tianjia Zhang 2020-06-23 1580 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
c992a4f6a9b0a3 James Hogan 2017-03-14 1581 ret = RESUME_HOST;
c992a4f6a9b0a3 James Hogan 2017-03-14 1582 break;
c992a4f6a9b0a3 James Hogan 2017-03-14 1583
c992a4f6a9b0a3 James Hogan 2017-03-14 1584 default:
c992a4f6a9b0a3 James Hogan 2017-03-14 1585 BUG();
c992a4f6a9b0a3 James Hogan 2017-03-14 1586 }
c992a4f6a9b0a3 James Hogan 2017-03-14 1587 return ret;
c992a4f6a9b0a3 James Hogan 2017-03-14 1588 }
c992a4f6a9b0a3 James Hogan 2017-03-14 1589
:::::: The code at line 1552 was first introduced by commit
:::::: c992a4f6a9b0a37c8bd7dfc727ecc3fed125c16b KVM: MIPS: Implement VZ support
:::::: TO: James Hogan <james.hogan(a)imgtec.com>
:::::: CC: James Hogan <james.hogan(a)imgtec.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse: sparse: incorrect type in argument 2 (different address spaces)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5833291ab6de9c3e2374336b51c814e515e8f3a5
commit: 894fa235eb4ca0bfa692dbe4932c2f940cdc8c1e powerpc: inline iomap accessors
date: 11 months ago
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 894fa235eb4ca0bfa692dbe4932c2f940cdc8c1e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse: expected void [noderef] __iomem *addr
drivers/net/wan/fsl_ucc_hdlc.c:305:57: sparse: got restricted __be16 *
>> drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse: expected void [noderef] __iomem *addr
drivers/net/wan/fsl_ucc_hdlc.c:307:46: sparse: got restricted __be32 *
drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse: expected void [noderef] __iomem *addr
drivers/net/wan/fsl_ucc_hdlc.c:316:57: sparse: got restricted __be16 *
drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse: expected void [noderef] __iomem *addr
drivers/net/wan/fsl_ucc_hdlc.c:318:46: sparse: got restricted __be32 *
drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __be16 [usertype] @@
drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: expected unsigned short [usertype]
drivers/net/wan/fsl_ucc_hdlc.c:368:29: sparse: got restricted __be16 [usertype]
drivers/net/wan/fsl_ucc_hdlc.c:375:36: sparse: sparse: restricted __be16 degrades to integer
drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qe_bd [noderef] __iomem *bd @@ got struct qe_bd *curtx_bd @@
drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse: expected struct qe_bd [noderef] __iomem *bd
drivers/net/wan/fsl_ucc_hdlc.c:398:12: sparse: got struct qe_bd *curtx_bd
drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qe_bd [noderef] __iomem *[assigned] bd @@ got struct qe_bd *tx_bd_base @@
drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse: expected struct qe_bd [noderef] __iomem *[assigned] bd
drivers/net/wan/fsl_ucc_hdlc.c:421:20: sparse: got struct qe_bd *tx_bd_base
drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse: struct qe_bd [noderef] __iomem *
drivers/net/wan/fsl_ucc_hdlc.c:423:16: sparse: struct qe_bd *
>> drivers/net/wan/fsl_ucc_hdlc.c:458:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:502:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:524:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:548:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:592:67: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:607:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:631:17: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int volatile [noderef] [usertype] __iomem *addr @@ got restricted __be32 [noderef] [usertype] __iomem *p_uccm @@
drivers/net/wan/fsl_ucc_hdlc.c:631:17: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int const volatile [noderef] [usertype] __iomem *addr @@ got restricted __be32 [noderef] [usertype] __iomem *p_uccm @@
drivers/net/wan/fsl_ucc_hdlc.c:850:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct qe_mux *qe_mux_reg @@ got struct qe_mux [noderef] __iomem * @@
>> drivers/net/wan/fsl_ucc_hdlc.c:853:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:854:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:857:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:860:37: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] __iomem *s @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:865:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct qe_mux *qe_mux_reg @@ got struct qe_mux [noderef] __iomem * @@
drivers/net/wan/fsl_ucc_hdlc.c:867:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *d @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:869:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:870:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:872:39: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:992:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:994:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:1003:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be16 * @@
drivers/net/wan/fsl_ucc_hdlc.c:1005:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got restricted __be32 * @@
drivers/net/wan/fsl_ucc_hdlc.c:408:35: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:408:35: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:723:29: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:814:21: sparse: sparse: dereference of noderef expression
drivers/net/wan/fsl_ucc_hdlc.c:1020:29: sparse: sparse: dereference of noderef expression
vim +305 drivers/net/wan/fsl_ucc_hdlc.c
c19b6d246a3562 Zhao Qiang 2016-06-06 77
c19b6d246a3562 Zhao Qiang 2016-06-06 78 static int uhdlc_init(struct ucc_hdlc_private *priv)
c19b6d246a3562 Zhao Qiang 2016-06-06 79 {
c19b6d246a3562 Zhao Qiang 2016-06-06 80 struct ucc_tdm_info *ut_info;
c19b6d246a3562 Zhao Qiang 2016-06-06 81 struct ucc_fast_info *uf_info;
c19b6d246a3562 Zhao Qiang 2016-06-06 82 u32 cecr_subblock;
c19b6d246a3562 Zhao Qiang 2016-06-06 83 u16 bd_status;
c19b6d246a3562 Zhao Qiang 2016-06-06 84 int ret, i;
c19b6d246a3562 Zhao Qiang 2016-06-06 85 void *bd_buffer;
c19b6d246a3562 Zhao Qiang 2016-06-06 86 dma_addr_t bd_dma_addr;
be2e9415f8b366 Rasmus Villemoes 2019-11-28 87 s32 riptr;
be2e9415f8b366 Rasmus Villemoes 2019-11-28 88 s32 tiptr;
c19b6d246a3562 Zhao Qiang 2016-06-06 89 u32 gumr;
c19b6d246a3562 Zhao Qiang 2016-06-06 90
c19b6d246a3562 Zhao Qiang 2016-06-06 91 ut_info = priv->ut_info;
c19b6d246a3562 Zhao Qiang 2016-06-06 92 uf_info = &ut_info->uf_info;
c19b6d246a3562 Zhao Qiang 2016-06-06 93
c19b6d246a3562 Zhao Qiang 2016-06-06 94 if (priv->tsa) {
c19b6d246a3562 Zhao Qiang 2016-06-06 95 uf_info->tsa = 1;
c19b6d246a3562 Zhao Qiang 2016-06-06 96 uf_info->ctsp = 1;
040b7c94e4ec58 David Gounaris 2018-09-03 97 uf_info->cds = 1;
040b7c94e4ec58 David Gounaris 2018-09-03 98 uf_info->ctss = 1;
040b7c94e4ec58 David Gounaris 2018-09-03 99 } else {
040b7c94e4ec58 David Gounaris 2018-09-03 100 uf_info->cds = 0;
040b7c94e4ec58 David Gounaris 2018-09-03 101 uf_info->ctsp = 0;
040b7c94e4ec58 David Gounaris 2018-09-03 102 uf_info->ctss = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 103 }
067bb938dad61e Holger Brunck 2017-05-17 104
067bb938dad61e Holger Brunck 2017-05-17 105 /* This sets HPM register in CMXUCR register which configures a
067bb938dad61e Holger Brunck 2017-05-17 106 * open drain connected HDLC bus
067bb938dad61e Holger Brunck 2017-05-17 107 */
067bb938dad61e Holger Brunck 2017-05-17 108 if (priv->hdlc_bus)
067bb938dad61e Holger Brunck 2017-05-17 109 uf_info->brkpt_support = 1;
067bb938dad61e Holger Brunck 2017-05-17 110
c19b6d246a3562 Zhao Qiang 2016-06-06 111 uf_info->uccm_mask = ((UCC_HDLC_UCCE_RXB | UCC_HDLC_UCCE_RXF |
c19b6d246a3562 Zhao Qiang 2016-06-06 112 UCC_HDLC_UCCE_TXB) << 16);
c19b6d246a3562 Zhao Qiang 2016-06-06 113
c19b6d246a3562 Zhao Qiang 2016-06-06 114 ret = ucc_fast_init(uf_info, &priv->uccf);
c19b6d246a3562 Zhao Qiang 2016-06-06 115 if (ret) {
c19b6d246a3562 Zhao Qiang 2016-06-06 116 dev_err(priv->dev, "Failed to init uccf.");
c19b6d246a3562 Zhao Qiang 2016-06-06 117 return ret;
c19b6d246a3562 Zhao Qiang 2016-06-06 118 }
c19b6d246a3562 Zhao Qiang 2016-06-06 119
c19b6d246a3562 Zhao Qiang 2016-06-06 120 priv->uf_regs = priv->uccf->uf_regs;
c19b6d246a3562 Zhao Qiang 2016-06-06 121 ucc_fast_disable(priv->uccf, COMM_DIR_RX | COMM_DIR_TX);
c19b6d246a3562 Zhao Qiang 2016-06-06 122
c19b6d246a3562 Zhao Qiang 2016-06-06 123 /* Loopback mode */
c19b6d246a3562 Zhao Qiang 2016-06-06 124 if (priv->loopback) {
c19b6d246a3562 Zhao Qiang 2016-06-06 125 dev_info(priv->dev, "Loopback Mode\n");
54e9e0874938ba Holger Brunck 2017-05-17 126 /* use the same clock when work in loopback */
54e9e0874938ba Holger Brunck 2017-05-17 127 qe_setbrg(ut_info->uf_info.rx_clock, 20000000, 1);
54e9e0874938ba Holger Brunck 2017-05-17 128
c19b6d246a3562 Zhao Qiang 2016-06-06 129 gumr = ioread32be(&priv->uf_regs->gumr);
c19b6d246a3562 Zhao Qiang 2016-06-06 130 gumr |= (UCC_FAST_GUMR_LOOPBACK | UCC_FAST_GUMR_CDS |
c19b6d246a3562 Zhao Qiang 2016-06-06 131 UCC_FAST_GUMR_TCI);
c19b6d246a3562 Zhao Qiang 2016-06-06 132 gumr &= ~(UCC_FAST_GUMR_CTSP | UCC_FAST_GUMR_RSYN);
c19b6d246a3562 Zhao Qiang 2016-06-06 133 iowrite32be(gumr, &priv->uf_regs->gumr);
c19b6d246a3562 Zhao Qiang 2016-06-06 134 }
c19b6d246a3562 Zhao Qiang 2016-06-06 135
c19b6d246a3562 Zhao Qiang 2016-06-06 136 /* Initialize SI */
c19b6d246a3562 Zhao Qiang 2016-06-06 137 if (priv->tsa)
c19b6d246a3562 Zhao Qiang 2016-06-06 138 ucc_tdm_init(priv->utdm, priv->ut_info);
c19b6d246a3562 Zhao Qiang 2016-06-06 139
c19b6d246a3562 Zhao Qiang 2016-06-06 140 /* Write to QE CECR, UCCx channel to Stop Transmission */
c19b6d246a3562 Zhao Qiang 2016-06-06 141 cecr_subblock = ucc_fast_get_qe_cr_subblock(uf_info->ucc_num);
c19b6d246a3562 Zhao Qiang 2016-06-06 142 ret = qe_issue_cmd(QE_STOP_TX, cecr_subblock,
c19b6d246a3562 Zhao Qiang 2016-06-06 143 QE_CR_PROTOCOL_UNSPECIFIED, 0);
c19b6d246a3562 Zhao Qiang 2016-06-06 144
c19b6d246a3562 Zhao Qiang 2016-06-06 145 /* Set UPSMR normal mode (need fixed)*/
c19b6d246a3562 Zhao Qiang 2016-06-06 146 iowrite32be(0, &priv->uf_regs->upsmr);
c19b6d246a3562 Zhao Qiang 2016-06-06 147
067bb938dad61e Holger Brunck 2017-05-17 148 /* hdlc_bus mode */
067bb938dad61e Holger Brunck 2017-05-17 149 if (priv->hdlc_bus) {
067bb938dad61e Holger Brunck 2017-05-17 150 u32 upsmr;
067bb938dad61e Holger Brunck 2017-05-17 151
067bb938dad61e Holger Brunck 2017-05-17 152 dev_info(priv->dev, "HDLC bus Mode\n");
067bb938dad61e Holger Brunck 2017-05-17 153 upsmr = ioread32be(&priv->uf_regs->upsmr);
067bb938dad61e Holger Brunck 2017-05-17 154
067bb938dad61e Holger Brunck 2017-05-17 155 /* bus mode and retransmit enable, with collision window
067bb938dad61e Holger Brunck 2017-05-17 156 * set to 8 bytes
067bb938dad61e Holger Brunck 2017-05-17 157 */
067bb938dad61e Holger Brunck 2017-05-17 158 upsmr |= UCC_HDLC_UPSMR_RTE | UCC_HDLC_UPSMR_BUS |
067bb938dad61e Holger Brunck 2017-05-17 159 UCC_HDLC_UPSMR_CW8;
067bb938dad61e Holger Brunck 2017-05-17 160 iowrite32be(upsmr, &priv->uf_regs->upsmr);
067bb938dad61e Holger Brunck 2017-05-17 161
067bb938dad61e Holger Brunck 2017-05-17 162 /* explicitly disable CDS & CTSP */
067bb938dad61e Holger Brunck 2017-05-17 163 gumr = ioread32be(&priv->uf_regs->gumr);
067bb938dad61e Holger Brunck 2017-05-17 164 gumr &= ~(UCC_FAST_GUMR_CDS | UCC_FAST_GUMR_CTSP);
067bb938dad61e Holger Brunck 2017-05-17 165 /* set automatic sync to explicitly ignore CD signal */
067bb938dad61e Holger Brunck 2017-05-17 166 gumr |= UCC_FAST_GUMR_SYNL_AUTO;
067bb938dad61e Holger Brunck 2017-05-17 167 iowrite32be(gumr, &priv->uf_regs->gumr);
067bb938dad61e Holger Brunck 2017-05-17 168 }
067bb938dad61e Holger Brunck 2017-05-17 169
c19b6d246a3562 Zhao Qiang 2016-06-06 170 priv->rx_ring_size = RX_BD_RING_LEN;
c19b6d246a3562 Zhao Qiang 2016-06-06 171 priv->tx_ring_size = TX_BD_RING_LEN;
c19b6d246a3562 Zhao Qiang 2016-06-06 172 /* Alloc Rx BD */
c19b6d246a3562 Zhao Qiang 2016-06-06 173 priv->rx_bd_base = dma_alloc_coherent(priv->dev,
5b8aad93c52bdd Holger Brunck 2017-05-17 174 RX_BD_RING_LEN * sizeof(struct qe_bd),
c19b6d246a3562 Zhao Qiang 2016-06-06 175 &priv->dma_rx_bd, GFP_KERNEL);
c19b6d246a3562 Zhao Qiang 2016-06-06 176
c19b6d246a3562 Zhao Qiang 2016-06-06 177 if (!priv->rx_bd_base) {
c19b6d246a3562 Zhao Qiang 2016-06-06 178 dev_err(priv->dev, "Cannot allocate MURAM memory for RxBDs\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 179 ret = -ENOMEM;
1efb597d8bf56c Zhao Qiang 2016-07-15 180 goto free_uccf;
c19b6d246a3562 Zhao Qiang 2016-06-06 181 }
c19b6d246a3562 Zhao Qiang 2016-06-06 182
c19b6d246a3562 Zhao Qiang 2016-06-06 183 /* Alloc Tx BD */
c19b6d246a3562 Zhao Qiang 2016-06-06 184 priv->tx_bd_base = dma_alloc_coherent(priv->dev,
5b8aad93c52bdd Holger Brunck 2017-05-17 185 TX_BD_RING_LEN * sizeof(struct qe_bd),
c19b6d246a3562 Zhao Qiang 2016-06-06 186 &priv->dma_tx_bd, GFP_KERNEL);
c19b6d246a3562 Zhao Qiang 2016-06-06 187
c19b6d246a3562 Zhao Qiang 2016-06-06 188 if (!priv->tx_bd_base) {
c19b6d246a3562 Zhao Qiang 2016-06-06 189 dev_err(priv->dev, "Cannot allocate MURAM memory for TxBDs\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 190 ret = -ENOMEM;
1efb597d8bf56c Zhao Qiang 2016-07-15 191 goto free_rx_bd;
c19b6d246a3562 Zhao Qiang 2016-06-06 192 }
c19b6d246a3562 Zhao Qiang 2016-06-06 193
c19b6d246a3562 Zhao Qiang 2016-06-06 194 /* Alloc parameter ram for ucc hdlc */
85deed56032b6c Holger Brunck 2017-05-22 195 priv->ucc_pram_offset = qe_muram_alloc(sizeof(struct ucc_hdlc_param),
c19b6d246a3562 Zhao Qiang 2016-06-06 196 ALIGNMENT_OF_UCC_HDLC_PRAM);
c19b6d246a3562 Zhao Qiang 2016-06-06 197
be2e9415f8b366 Rasmus Villemoes 2019-11-28 198 if (priv->ucc_pram_offset < 0) {
24a24d07d688a4 Colin Ian King 2016-08-28 199 dev_err(priv->dev, "Can not allocate MURAM for hdlc parameter.\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 200 ret = -ENOMEM;
1efb597d8bf56c Zhao Qiang 2016-07-15 201 goto free_tx_bd;
c19b6d246a3562 Zhao Qiang 2016-06-06 202 }
c19b6d246a3562 Zhao Qiang 2016-06-06 203
6396bb221514d2 Kees Cook 2018-06-12 204 priv->rx_skbuff = kcalloc(priv->rx_ring_size,
6396bb221514d2 Kees Cook 2018-06-12 205 sizeof(*priv->rx_skbuff),
c19b6d246a3562 Zhao Qiang 2016-06-06 206 GFP_KERNEL);
c19b6d246a3562 Zhao Qiang 2016-06-06 207 if (!priv->rx_skbuff)
1efb597d8bf56c Zhao Qiang 2016-07-15 208 goto free_ucc_pram;
c19b6d246a3562 Zhao Qiang 2016-06-06 209
6396bb221514d2 Kees Cook 2018-06-12 210 priv->tx_skbuff = kcalloc(priv->tx_ring_size,
6396bb221514d2 Kees Cook 2018-06-12 211 sizeof(*priv->tx_skbuff),
c19b6d246a3562 Zhao Qiang 2016-06-06 212 GFP_KERNEL);
c19b6d246a3562 Zhao Qiang 2016-06-06 213 if (!priv->tx_skbuff)
1efb597d8bf56c Zhao Qiang 2016-07-15 214 goto free_rx_skbuff;
c19b6d246a3562 Zhao Qiang 2016-06-06 215
c19b6d246a3562 Zhao Qiang 2016-06-06 216 priv->skb_curtx = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 217 priv->skb_dirtytx = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 218 priv->curtx_bd = priv->tx_bd_base;
c19b6d246a3562 Zhao Qiang 2016-06-06 219 priv->dirty_tx = priv->tx_bd_base;
c19b6d246a3562 Zhao Qiang 2016-06-06 220 priv->currx_bd = priv->rx_bd_base;
c19b6d246a3562 Zhao Qiang 2016-06-06 221 priv->currx_bdnum = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 222
c19b6d246a3562 Zhao Qiang 2016-06-06 223 /* init parameter base */
c19b6d246a3562 Zhao Qiang 2016-06-06 224 cecr_subblock = ucc_fast_get_qe_cr_subblock(uf_info->ucc_num);
c19b6d246a3562 Zhao Qiang 2016-06-06 225 ret = qe_issue_cmd(QE_ASSIGN_PAGE_TO_DEVICE, cecr_subblock,
c19b6d246a3562 Zhao Qiang 2016-06-06 226 QE_CR_PROTOCOL_UNSPECIFIED, priv->ucc_pram_offset);
c19b6d246a3562 Zhao Qiang 2016-06-06 227
c19b6d246a3562 Zhao Qiang 2016-06-06 228 priv->ucc_pram = (struct ucc_hdlc_param __iomem *)
c19b6d246a3562 Zhao Qiang 2016-06-06 229 qe_muram_addr(priv->ucc_pram_offset);
c19b6d246a3562 Zhao Qiang 2016-06-06 230
c19b6d246a3562 Zhao Qiang 2016-06-06 231 /* Zero out parameter ram */
c19b6d246a3562 Zhao Qiang 2016-06-06 232 memset_io(priv->ucc_pram, 0, sizeof(struct ucc_hdlc_param));
c19b6d246a3562 Zhao Qiang 2016-06-06 233
c19b6d246a3562 Zhao Qiang 2016-06-06 234 /* Alloc riptr, tiptr */
c19b6d246a3562 Zhao Qiang 2016-06-06 235 riptr = qe_muram_alloc(32, 32);
be2e9415f8b366 Rasmus Villemoes 2019-11-28 236 if (riptr < 0) {
c19b6d246a3562 Zhao Qiang 2016-06-06 237 dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 238 ret = -ENOMEM;
1efb597d8bf56c Zhao Qiang 2016-07-15 239 goto free_tx_skbuff;
c19b6d246a3562 Zhao Qiang 2016-06-06 240 }
c19b6d246a3562 Zhao Qiang 2016-06-06 241
c19b6d246a3562 Zhao Qiang 2016-06-06 242 tiptr = qe_muram_alloc(32, 32);
be2e9415f8b366 Rasmus Villemoes 2019-11-28 243 if (tiptr < 0) {
c19b6d246a3562 Zhao Qiang 2016-06-06 244 dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 245 ret = -ENOMEM;
1efb597d8bf56c Zhao Qiang 2016-07-15 246 goto free_riptr;
c19b6d246a3562 Zhao Qiang 2016-06-06 247 }
148587a59f6b85 Rasmus Villemoes 2019-11-28 248 if (riptr != (u16)riptr || tiptr != (u16)tiptr) {
148587a59f6b85 Rasmus Villemoes 2019-11-28 249 dev_err(priv->dev, "MURAM allocation out of addressable range\n");
148587a59f6b85 Rasmus Villemoes 2019-11-28 250 ret = -ENOMEM;
148587a59f6b85 Rasmus Villemoes 2019-11-28 251 goto free_tiptr;
148587a59f6b85 Rasmus Villemoes 2019-11-28 252 }
c19b6d246a3562 Zhao Qiang 2016-06-06 253
c19b6d246a3562 Zhao Qiang 2016-06-06 254 /* Set RIPTR, TIPTR */
c19b6d246a3562 Zhao Qiang 2016-06-06 255 iowrite16be(riptr, &priv->ucc_pram->riptr);
c19b6d246a3562 Zhao Qiang 2016-06-06 256 iowrite16be(tiptr, &priv->ucc_pram->tiptr);
c19b6d246a3562 Zhao Qiang 2016-06-06 257
c19b6d246a3562 Zhao Qiang 2016-06-06 258 /* Set MRBLR */
c19b6d246a3562 Zhao Qiang 2016-06-06 259 iowrite16be(MAX_RX_BUF_LENGTH, &priv->ucc_pram->mrblr);
c19b6d246a3562 Zhao Qiang 2016-06-06 260
c19b6d246a3562 Zhao Qiang 2016-06-06 261 /* Set RBASE, TBASE */
c19b6d246a3562 Zhao Qiang 2016-06-06 262 iowrite32be(priv->dma_rx_bd, &priv->ucc_pram->rbase);
c19b6d246a3562 Zhao Qiang 2016-06-06 263 iowrite32be(priv->dma_tx_bd, &priv->ucc_pram->tbase);
c19b6d246a3562 Zhao Qiang 2016-06-06 264
c19b6d246a3562 Zhao Qiang 2016-06-06 265 /* Set RSTATE, TSTATE */
c19b6d246a3562 Zhao Qiang 2016-06-06 266 iowrite32be(BMR_GBL | BMR_BIG_ENDIAN, &priv->ucc_pram->rstate);
c19b6d246a3562 Zhao Qiang 2016-06-06 267 iowrite32be(BMR_GBL | BMR_BIG_ENDIAN, &priv->ucc_pram->tstate);
c19b6d246a3562 Zhao Qiang 2016-06-06 268
c19b6d246a3562 Zhao Qiang 2016-06-06 269 /* Set C_MASK, C_PRES for 16bit CRC */
c19b6d246a3562 Zhao Qiang 2016-06-06 270 iowrite32be(CRC_16BIT_MASK, &priv->ucc_pram->c_mask);
c19b6d246a3562 Zhao Qiang 2016-06-06 271 iowrite32be(CRC_16BIT_PRES, &priv->ucc_pram->c_pres);
c19b6d246a3562 Zhao Qiang 2016-06-06 272
c19b6d246a3562 Zhao Qiang 2016-06-06 273 iowrite16be(MAX_FRAME_LENGTH, &priv->ucc_pram->mflr);
c19b6d246a3562 Zhao Qiang 2016-06-06 274 iowrite16be(DEFAULT_RFTHR, &priv->ucc_pram->rfthr);
c19b6d246a3562 Zhao Qiang 2016-06-06 275 iowrite16be(DEFAULT_RFTHR, &priv->ucc_pram->rfcnt);
045f77baf6b429 David Gounaris 2018-09-03 276 iowrite16be(priv->hmask, &priv->ucc_pram->hmask);
c19b6d246a3562 Zhao Qiang 2016-06-06 277 iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr1);
c19b6d246a3562 Zhao Qiang 2016-06-06 278 iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr2);
c19b6d246a3562 Zhao Qiang 2016-06-06 279 iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr3);
c19b6d246a3562 Zhao Qiang 2016-06-06 280 iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr4);
c19b6d246a3562 Zhao Qiang 2016-06-06 281
c19b6d246a3562 Zhao Qiang 2016-06-06 282 /* Get BD buffer */
750afb08ca7131 Luis Chamberlain 2019-01-04 283 bd_buffer = dma_alloc_coherent(priv->dev,
750afb08ca7131 Luis Chamberlain 2019-01-04 284 (RX_BD_RING_LEN + TX_BD_RING_LEN) * MAX_RX_BUF_LENGTH,
c19b6d246a3562 Zhao Qiang 2016-06-06 285 &bd_dma_addr, GFP_KERNEL);
c19b6d246a3562 Zhao Qiang 2016-06-06 286
c19b6d246a3562 Zhao Qiang 2016-06-06 287 if (!bd_buffer) {
c19b6d246a3562 Zhao Qiang 2016-06-06 288 dev_err(priv->dev, "Could not allocate buffer descriptors\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 289 ret = -ENOMEM;
1efb597d8bf56c Zhao Qiang 2016-07-15 290 goto free_tiptr;
c19b6d246a3562 Zhao Qiang 2016-06-06 291 }
c19b6d246a3562 Zhao Qiang 2016-06-06 292
c19b6d246a3562 Zhao Qiang 2016-06-06 293 priv->rx_buffer = bd_buffer;
c19b6d246a3562 Zhao Qiang 2016-06-06 294 priv->tx_buffer = bd_buffer + RX_BD_RING_LEN * MAX_RX_BUF_LENGTH;
c19b6d246a3562 Zhao Qiang 2016-06-06 295
c19b6d246a3562 Zhao Qiang 2016-06-06 296 priv->dma_rx_addr = bd_dma_addr;
c19b6d246a3562 Zhao Qiang 2016-06-06 297 priv->dma_tx_addr = bd_dma_addr + RX_BD_RING_LEN * MAX_RX_BUF_LENGTH;
c19b6d246a3562 Zhao Qiang 2016-06-06 298
c19b6d246a3562 Zhao Qiang 2016-06-06 299 for (i = 0; i < RX_BD_RING_LEN; i++) {
c19b6d246a3562 Zhao Qiang 2016-06-06 300 if (i < (RX_BD_RING_LEN - 1))
c19b6d246a3562 Zhao Qiang 2016-06-06 301 bd_status = R_E_S | R_I_S;
c19b6d246a3562 Zhao Qiang 2016-06-06 302 else
c19b6d246a3562 Zhao Qiang 2016-06-06 303 bd_status = R_E_S | R_I_S | R_W_S;
c19b6d246a3562 Zhao Qiang 2016-06-06 304
c19b6d246a3562 Zhao Qiang 2016-06-06 @305 iowrite16be(bd_status, &priv->rx_bd_base[i].status);
c19b6d246a3562 Zhao Qiang 2016-06-06 306 iowrite32be(priv->dma_rx_addr + i * MAX_RX_BUF_LENGTH,
c19b6d246a3562 Zhao Qiang 2016-06-06 @307 &priv->rx_bd_base[i].buf);
c19b6d246a3562 Zhao Qiang 2016-06-06 308 }
c19b6d246a3562 Zhao Qiang 2016-06-06 309
c19b6d246a3562 Zhao Qiang 2016-06-06 310 for (i = 0; i < TX_BD_RING_LEN; i++) {
c19b6d246a3562 Zhao Qiang 2016-06-06 311 if (i < (TX_BD_RING_LEN - 1))
c19b6d246a3562 Zhao Qiang 2016-06-06 312 bd_status = T_I_S | T_TC_S;
c19b6d246a3562 Zhao Qiang 2016-06-06 313 else
c19b6d246a3562 Zhao Qiang 2016-06-06 314 bd_status = T_I_S | T_TC_S | T_W_S;
c19b6d246a3562 Zhao Qiang 2016-06-06 315
c19b6d246a3562 Zhao Qiang 2016-06-06 316 iowrite16be(bd_status, &priv->tx_bd_base[i].status);
c19b6d246a3562 Zhao Qiang 2016-06-06 317 iowrite32be(priv->dma_tx_addr + i * MAX_RX_BUF_LENGTH,
c19b6d246a3562 Zhao Qiang 2016-06-06 318 &priv->tx_bd_base[i].buf);
c19b6d246a3562 Zhao Qiang 2016-06-06 319 }
c19b6d246a3562 Zhao Qiang 2016-06-06 320
c19b6d246a3562 Zhao Qiang 2016-06-06 321 return 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 322
1efb597d8bf56c Zhao Qiang 2016-07-15 323 free_tiptr:
c19b6d246a3562 Zhao Qiang 2016-06-06 324 qe_muram_free(tiptr);
1efb597d8bf56c Zhao Qiang 2016-07-15 325 free_riptr:
c19b6d246a3562 Zhao Qiang 2016-06-06 326 qe_muram_free(riptr);
1efb597d8bf56c Zhao Qiang 2016-07-15 327 free_tx_skbuff:
c19b6d246a3562 Zhao Qiang 2016-06-06 328 kfree(priv->tx_skbuff);
1efb597d8bf56c Zhao Qiang 2016-07-15 329 free_rx_skbuff:
c19b6d246a3562 Zhao Qiang 2016-06-06 330 kfree(priv->rx_skbuff);
1efb597d8bf56c Zhao Qiang 2016-07-15 331 free_ucc_pram:
c19b6d246a3562 Zhao Qiang 2016-06-06 332 qe_muram_free(priv->ucc_pram_offset);
1efb597d8bf56c Zhao Qiang 2016-07-15 333 free_tx_bd:
c19b6d246a3562 Zhao Qiang 2016-06-06 334 dma_free_coherent(priv->dev,
5b8aad93c52bdd Holger Brunck 2017-05-17 335 TX_BD_RING_LEN * sizeof(struct qe_bd),
c19b6d246a3562 Zhao Qiang 2016-06-06 336 priv->tx_bd_base, priv->dma_tx_bd);
1efb597d8bf56c Zhao Qiang 2016-07-15 337 free_rx_bd:
c19b6d246a3562 Zhao Qiang 2016-06-06 338 dma_free_coherent(priv->dev,
5b8aad93c52bdd Holger Brunck 2017-05-17 339 RX_BD_RING_LEN * sizeof(struct qe_bd),
c19b6d246a3562 Zhao Qiang 2016-06-06 340 priv->rx_bd_base, priv->dma_rx_bd);
1efb597d8bf56c Zhao Qiang 2016-07-15 341 free_uccf:
c19b6d246a3562 Zhao Qiang 2016-06-06 342 ucc_fast_free(priv->uccf);
c19b6d246a3562 Zhao Qiang 2016-06-06 343
c19b6d246a3562 Zhao Qiang 2016-06-06 344 return ret;
c19b6d246a3562 Zhao Qiang 2016-06-06 345 }
c19b6d246a3562 Zhao Qiang 2016-06-06 346
c19b6d246a3562 Zhao Qiang 2016-06-06 347 static netdev_tx_t ucc_hdlc_tx(struct sk_buff *skb, struct net_device *dev)
c19b6d246a3562 Zhao Qiang 2016-06-06 348 {
c19b6d246a3562 Zhao Qiang 2016-06-06 349 hdlc_device *hdlc = dev_to_hdlc(dev);
c19b6d246a3562 Zhao Qiang 2016-06-06 350 struct ucc_hdlc_private *priv = (struct ucc_hdlc_private *)hdlc->priv;
c19b6d246a3562 Zhao Qiang 2016-06-06 351 struct qe_bd __iomem *bd;
c19b6d246a3562 Zhao Qiang 2016-06-06 352 u16 bd_status;
c19b6d246a3562 Zhao Qiang 2016-06-06 353 unsigned long flags;
c19b6d246a3562 Zhao Qiang 2016-06-06 354 u16 *proto_head;
c19b6d246a3562 Zhao Qiang 2016-06-06 355
c19b6d246a3562 Zhao Qiang 2016-06-06 356 switch (dev->type) {
c19b6d246a3562 Zhao Qiang 2016-06-06 357 case ARPHRD_RAWHDLC:
c19b6d246a3562 Zhao Qiang 2016-06-06 358 if (skb_headroom(skb) < HDLC_HEAD_LEN) {
c19b6d246a3562 Zhao Qiang 2016-06-06 359 dev->stats.tx_dropped++;
c19b6d246a3562 Zhao Qiang 2016-06-06 360 dev_kfree_skb(skb);
c19b6d246a3562 Zhao Qiang 2016-06-06 361 netdev_err(dev, "No enough space for hdlc head\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 362 return -ENOMEM;
c19b6d246a3562 Zhao Qiang 2016-06-06 363 }
c19b6d246a3562 Zhao Qiang 2016-06-06 364
c19b6d246a3562 Zhao Qiang 2016-06-06 365 skb_push(skb, HDLC_HEAD_LEN);
c19b6d246a3562 Zhao Qiang 2016-06-06 366
c19b6d246a3562 Zhao Qiang 2016-06-06 367 proto_head = (u16 *)skb->data;
c19b6d246a3562 Zhao Qiang 2016-06-06 368 *proto_head = htons(DEFAULT_HDLC_HEAD);
c19b6d246a3562 Zhao Qiang 2016-06-06 369
c19b6d246a3562 Zhao Qiang 2016-06-06 370 dev->stats.tx_bytes += skb->len;
c19b6d246a3562 Zhao Qiang 2016-06-06 371 break;
c19b6d246a3562 Zhao Qiang 2016-06-06 372
c19b6d246a3562 Zhao Qiang 2016-06-06 373 case ARPHRD_PPP:
c19b6d246a3562 Zhao Qiang 2016-06-06 374 proto_head = (u16 *)skb->data;
c19b6d246a3562 Zhao Qiang 2016-06-06 375 if (*proto_head != htons(DEFAULT_PPP_HEAD)) {
c19b6d246a3562 Zhao Qiang 2016-06-06 376 dev->stats.tx_dropped++;
c19b6d246a3562 Zhao Qiang 2016-06-06 377 dev_kfree_skb(skb);
c19b6d246a3562 Zhao Qiang 2016-06-06 378 netdev_err(dev, "Wrong ppp header\n");
c19b6d246a3562 Zhao Qiang 2016-06-06 379 return -ENOMEM;
c19b6d246a3562 Zhao Qiang 2016-06-06 380 }
c19b6d246a3562 Zhao Qiang 2016-06-06 381
c19b6d246a3562 Zhao Qiang 2016-06-06 382 dev->stats.tx_bytes += skb->len;
c19b6d246a3562 Zhao Qiang 2016-06-06 383 break;
c19b6d246a3562 Zhao Qiang 2016-06-06 384
8978ca7c8b7b07 David Gounaris 2018-09-03 385 case ARPHRD_ETHER:
8978ca7c8b7b07 David Gounaris 2018-09-03 386 dev->stats.tx_bytes += skb->len;
8978ca7c8b7b07 David Gounaris 2018-09-03 387 break;
8978ca7c8b7b07 David Gounaris 2018-09-03 388
c19b6d246a3562 Zhao Qiang 2016-06-06 389 default:
c19b6d246a3562 Zhao Qiang 2016-06-06 390 dev->stats.tx_dropped++;
c19b6d246a3562 Zhao Qiang 2016-06-06 391 dev_kfree_skb(skb);
c19b6d246a3562 Zhao Qiang 2016-06-06 392 return -ENOMEM;
c19b6d246a3562 Zhao Qiang 2016-06-06 393 }
2e7ad56aa54778 Mathias Thore 2018-11-07 394 netdev_sent_queue(dev, skb->len);
c19b6d246a3562 Zhao Qiang 2016-06-06 395 spin_lock_irqsave(&priv->lock, flags);
c19b6d246a3562 Zhao Qiang 2016-06-06 396
c19b6d246a3562 Zhao Qiang 2016-06-06 397 /* Start from the next BD that should be filled */
c19b6d246a3562 Zhao Qiang 2016-06-06 398 bd = priv->curtx_bd;
c19b6d246a3562 Zhao Qiang 2016-06-06 399 bd_status = ioread16be(&bd->status);
c19b6d246a3562 Zhao Qiang 2016-06-06 400 /* Save the skb pointer so we can free it later */
c19b6d246a3562 Zhao Qiang 2016-06-06 401 priv->tx_skbuff[priv->skb_curtx] = skb;
c19b6d246a3562 Zhao Qiang 2016-06-06 402
c19b6d246a3562 Zhao Qiang 2016-06-06 403 /* Update the current skb pointer (wrapping if this was the last) */
c19b6d246a3562 Zhao Qiang 2016-06-06 404 priv->skb_curtx =
c19b6d246a3562 Zhao Qiang 2016-06-06 405 (priv->skb_curtx + 1) & TX_RING_MOD_MASK(TX_BD_RING_LEN);
c19b6d246a3562 Zhao Qiang 2016-06-06 406
c19b6d246a3562 Zhao Qiang 2016-06-06 407 /* copy skb data to tx buffer for sdma processing */
c19b6d246a3562 Zhao Qiang 2016-06-06 408 memcpy(priv->tx_buffer + (be32_to_cpu(bd->buf) - priv->dma_tx_addr),
c19b6d246a3562 Zhao Qiang 2016-06-06 409 skb->data, skb->len);
c19b6d246a3562 Zhao Qiang 2016-06-06 410
c19b6d246a3562 Zhao Qiang 2016-06-06 411 /* set bd status and length */
c19b6d246a3562 Zhao Qiang 2016-06-06 412 bd_status = (bd_status & T_W_S) | T_R_S | T_I_S | T_L_S | T_TC_S;
c19b6d246a3562 Zhao Qiang 2016-06-06 413
c19b6d246a3562 Zhao Qiang 2016-06-06 414 iowrite16be(skb->len, &bd->length);
02bb56ddc67116 Zhao Qiang 2017-03-14 415 iowrite16be(bd_status, &bd->status);
c19b6d246a3562 Zhao Qiang 2016-06-06 416
c19b6d246a3562 Zhao Qiang 2016-06-06 417 /* Move to next BD in the ring */
c19b6d246a3562 Zhao Qiang 2016-06-06 418 if (!(bd_status & T_W_S))
c19b6d246a3562 Zhao Qiang 2016-06-06 419 bd += 1;
c19b6d246a3562 Zhao Qiang 2016-06-06 420 else
c19b6d246a3562 Zhao Qiang 2016-06-06 421 bd = priv->tx_bd_base;
c19b6d246a3562 Zhao Qiang 2016-06-06 422
c19b6d246a3562 Zhao Qiang 2016-06-06 423 if (bd == priv->dirty_tx) {
c19b6d246a3562 Zhao Qiang 2016-06-06 424 if (!netif_queue_stopped(dev))
c19b6d246a3562 Zhao Qiang 2016-06-06 425 netif_stop_queue(dev);
c19b6d246a3562 Zhao Qiang 2016-06-06 426 }
c19b6d246a3562 Zhao Qiang 2016-06-06 427
c19b6d246a3562 Zhao Qiang 2016-06-06 428 priv->curtx_bd = bd;
c19b6d246a3562 Zhao Qiang 2016-06-06 429
c19b6d246a3562 Zhao Qiang 2016-06-06 430 spin_unlock_irqrestore(&priv->lock, flags);
c19b6d246a3562 Zhao Qiang 2016-06-06 431
c19b6d246a3562 Zhao Qiang 2016-06-06 432 return NETDEV_TX_OK;
c19b6d246a3562 Zhao Qiang 2016-06-06 433 }
c19b6d246a3562 Zhao Qiang 2016-06-06 434
ba59d5705825fb Mathias Thore 2018-10-22 435 static int hdlc_tx_restart(struct ucc_hdlc_private *priv)
ba59d5705825fb Mathias Thore 2018-10-22 436 {
ba59d5705825fb Mathias Thore 2018-10-22 437 u32 cecr_subblock;
ba59d5705825fb Mathias Thore 2018-10-22 438
ba59d5705825fb Mathias Thore 2018-10-22 439 cecr_subblock =
ba59d5705825fb Mathias Thore 2018-10-22 440 ucc_fast_get_qe_cr_subblock(priv->ut_info->uf_info.ucc_num);
ba59d5705825fb Mathias Thore 2018-10-22 441
ba59d5705825fb Mathias Thore 2018-10-22 442 qe_issue_cmd(QE_RESTART_TX, cecr_subblock,
ba59d5705825fb Mathias Thore 2018-10-22 443 QE_CR_PROTOCOL_UNSPECIFIED, 0);
ba59d5705825fb Mathias Thore 2018-10-22 444 return 0;
ba59d5705825fb Mathias Thore 2018-10-22 445 }
ba59d5705825fb Mathias Thore 2018-10-22 446
c19b6d246a3562 Zhao Qiang 2016-06-06 447 static int hdlc_tx_done(struct ucc_hdlc_private *priv)
c19b6d246a3562 Zhao Qiang 2016-06-06 448 {
c19b6d246a3562 Zhao Qiang 2016-06-06 449 /* Start from the next BD that should be filled */
c19b6d246a3562 Zhao Qiang 2016-06-06 450 struct net_device *dev = priv->ndev;
2e7ad56aa54778 Mathias Thore 2018-11-07 451 unsigned int bytes_sent = 0;
2e7ad56aa54778 Mathias Thore 2018-11-07 452 int howmany = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 453 struct qe_bd *bd; /* BD pointer */
c19b6d246a3562 Zhao Qiang 2016-06-06 454 u16 bd_status;
ba59d5705825fb Mathias Thore 2018-10-22 455 int tx_restart = 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 456
c19b6d246a3562 Zhao Qiang 2016-06-06 457 bd = priv->dirty_tx;
c19b6d246a3562 Zhao Qiang 2016-06-06 @458 bd_status = ioread16be(&bd->status);
c19b6d246a3562 Zhao Qiang 2016-06-06 459
c19b6d246a3562 Zhao Qiang 2016-06-06 460 /* Normal processing. */
c19b6d246a3562 Zhao Qiang 2016-06-06 461 while ((bd_status & T_R_S) == 0) {
c19b6d246a3562 Zhao Qiang 2016-06-06 462 struct sk_buff *skb;
c19b6d246a3562 Zhao Qiang 2016-06-06 463
ba59d5705825fb Mathias Thore 2018-10-22 464 if (bd_status & T_UN_S) { /* Underrun */
ba59d5705825fb Mathias Thore 2018-10-22 465 dev->stats.tx_fifo_errors++;
ba59d5705825fb Mathias Thore 2018-10-22 466 tx_restart = 1;
ba59d5705825fb Mathias Thore 2018-10-22 467 }
ba59d5705825fb Mathias Thore 2018-10-22 468 if (bd_status & T_CT_S) { /* Carrier lost */
ba59d5705825fb Mathias Thore 2018-10-22 469 dev->stats.tx_carrier_errors++;
ba59d5705825fb Mathias Thore 2018-10-22 470 tx_restart = 1;
ba59d5705825fb Mathias Thore 2018-10-22 471 }
ba59d5705825fb Mathias Thore 2018-10-22 472
c19b6d246a3562 Zhao Qiang 2016-06-06 473 /* BD contains already transmitted buffer. */
c19b6d246a3562 Zhao Qiang 2016-06-06 474 /* Handle the transmitted buffer and release */
c19b6d246a3562 Zhao Qiang 2016-06-06 475 /* the BD to be used with the current frame */
c19b6d246a3562 Zhao Qiang 2016-06-06 476
c19b6d246a3562 Zhao Qiang 2016-06-06 477 skb = priv->tx_skbuff[priv->skb_dirtytx];
c19b6d246a3562 Zhao Qiang 2016-06-06 478 if (!skb)
c19b6d246a3562 Zhao Qiang 2016-06-06 479 break;
2e7ad56aa54778 Mathias Thore 2018-11-07 480 howmany++;
2e7ad56aa54778 Mathias Thore 2018-11-07 481 bytes_sent += skb->len;
c19b6d246a3562 Zhao Qiang 2016-06-06 482 dev->stats.tx_packets++;
c19b6d246a3562 Zhao Qiang 2016-06-06 483 memset(priv->tx_buffer +
c19b6d246a3562 Zhao Qiang 2016-06-06 484 (be32_to_cpu(bd->buf) - priv->dma_tx_addr),
c19b6d246a3562 Zhao Qiang 2016-06-06 485 0, skb->len);
7c3850adbcccc2 Yang Wei 2019-02-06 486 dev_consume_skb_irq(skb);
c19b6d246a3562 Zhao Qiang 2016-06-06 487
c19b6d246a3562 Zhao Qiang 2016-06-06 488 priv->tx_skbuff[priv->skb_dirtytx] = NULL;
c19b6d246a3562 Zhao Qiang 2016-06-06 489 priv->skb_dirtytx =
c19b6d246a3562 Zhao Qiang 2016-06-06 490 (priv->skb_dirtytx +
c19b6d246a3562 Zhao Qiang 2016-06-06 491 1) & TX_RING_MOD_MASK(TX_BD_RING_LEN);
c19b6d246a3562 Zhao Qiang 2016-06-06 492
c19b6d246a3562 Zhao Qiang 2016-06-06 493 /* We freed a buffer, so now we can restart transmission */
c19b6d246a3562 Zhao Qiang 2016-06-06 494 if (netif_queue_stopped(dev))
c19b6d246a3562 Zhao Qiang 2016-06-06 495 netif_wake_queue(dev);
c19b6d246a3562 Zhao Qiang 2016-06-06 496
c19b6d246a3562 Zhao Qiang 2016-06-06 497 /* Advance the confirmation BD pointer */
c19b6d246a3562 Zhao Qiang 2016-06-06 498 if (!(bd_status & T_W_S))
c19b6d246a3562 Zhao Qiang 2016-06-06 499 bd += 1;
c19b6d246a3562 Zhao Qiang 2016-06-06 500 else
c19b6d246a3562 Zhao Qiang 2016-06-06 501 bd = priv->tx_bd_base;
c19b6d246a3562 Zhao Qiang 2016-06-06 502 bd_status = ioread16be(&bd->status);
c19b6d246a3562 Zhao Qiang 2016-06-06 503 }
c19b6d246a3562 Zhao Qiang 2016-06-06 504 priv->dirty_tx = bd;
c19b6d246a3562 Zhao Qiang 2016-06-06 505
ba59d5705825fb Mathias Thore 2018-10-22 506 if (tx_restart)
ba59d5705825fb Mathias Thore 2018-10-22 507 hdlc_tx_restart(priv);
ba59d5705825fb Mathias Thore 2018-10-22 508
2e7ad56aa54778 Mathias Thore 2018-11-07 509 netdev_completed_queue(dev, howmany, bytes_sent);
c19b6d246a3562 Zhao Qiang 2016-06-06 510 return 0;
c19b6d246a3562 Zhao Qiang 2016-06-06 511 }
c19b6d246a3562 Zhao Qiang 2016-06-06 512
:::::: The code at line 305 was first introduced by commit
:::::: c19b6d246a35627c3a69b2fa6bdece212b48214b drivers/net: support hdlc function for QE-UCC
:::::: TO: Zhao Qiang <qiang.zhao(a)nxp.com>
:::::: CC: David S. Miller <davem(a)davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
drivers/rtc/rtc-ntxec.c:91:53: sparse: sparse: incorrect type in initializer (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5833291ab6de9c3e2374336b51c814e515e8f3a5
commit: 435af89786c674583b188f7322fee5c03894b8b7 rtc: New driver for RTC in Netronix embedded controller
date: 8 months ago
config: riscv-randconfig-s031-20211109 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 435af89786c674583b188f7322fee5c03894b8b7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash block/ drivers/hid/ drivers/i2c/busses/ drivers/message/fusion/ drivers/net/ethernet/ drivers/net/wireless/intel/iwlwifi/ drivers/pci/ drivers/remoteproc/ drivers/rtc/ drivers/staging/rts5208/ drivers/staging/vc04_services/ drivers/vdpa/ drivers/video/fbdev/ net/qrtr/ net/sched/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/rtc/rtc-ntxec.c:91:53: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int def @@ got restricted __be16 @@
drivers/rtc/rtc-ntxec.c:91:53: sparse: expected unsigned int def
drivers/rtc/rtc-ntxec.c:91:53: sparse: got restricted __be16
drivers/rtc/rtc-ntxec.c:92:51: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int def @@ got restricted __be16 @@
drivers/rtc/rtc-ntxec.c:92:51: sparse: expected unsigned int def
drivers/rtc/rtc-ntxec.c:92:51: sparse: got restricted __be16
drivers/rtc/rtc-ntxec.c:93:52: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int def @@ got restricted __be16 @@
drivers/rtc/rtc-ntxec.c:93:52: sparse: expected unsigned int def
drivers/rtc/rtc-ntxec.c:93:52: sparse: got restricted __be16
drivers/rtc/rtc-ntxec.c:94:50: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int def @@ got restricted __be16 @@
drivers/rtc/rtc-ntxec.c:94:50: sparse: expected unsigned int def
drivers/rtc/rtc-ntxec.c:94:50: sparse: got restricted __be16
drivers/rtc/rtc-ntxec.c:95:51: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int def @@ got restricted __be16 @@
drivers/rtc/rtc-ntxec.c:95:51: sparse: expected unsigned int def
drivers/rtc/rtc-ntxec.c:95:51: sparse: got restricted __be16
drivers/rtc/rtc-ntxec.c:96:53: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int def @@ got restricted __be16 @@
drivers/rtc/rtc-ntxec.c:96:53: sparse: expected unsigned int def
drivers/rtc/rtc-ntxec.c:96:53: sparse: got restricted __be16
drivers/rtc/rtc-ntxec.c:97:53: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int def @@ got restricted __be16 @@
drivers/rtc/rtc-ntxec.c:97:53: sparse: expected unsigned int def
drivers/rtc/rtc-ntxec.c:97:53: sparse: got restricted __be16
drivers/rtc/rtc-ntxec.c: note: in included file:
include/linux/mfd/ntxec.h:31:22: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be16 @@ got int @@
include/linux/mfd/ntxec.h:31:22: sparse: expected restricted __be16
include/linux/mfd/ntxec.h:31:22: sparse: got int
include/linux/mfd/ntxec.h:31:22: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be16 @@ got int @@
include/linux/mfd/ntxec.h:31:22: sparse: expected restricted __be16
include/linux/mfd/ntxec.h:31:22: sparse: got int
include/linux/mfd/ntxec.h:31:22: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be16 @@ got int @@
include/linux/mfd/ntxec.h:31:22: sparse: expected restricted __be16
include/linux/mfd/ntxec.h:31:22: sparse: got int
include/linux/mfd/ntxec.h:31:22: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be16 @@ got int @@
include/linux/mfd/ntxec.h:31:22: sparse: expected restricted __be16
include/linux/mfd/ntxec.h:31:22: sparse: got int
include/linux/mfd/ntxec.h:31:22: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be16 @@ got int @@
include/linux/mfd/ntxec.h:31:22: sparse: expected restricted __be16
include/linux/mfd/ntxec.h:31:22: sparse: got int
include/linux/mfd/ntxec.h:31:22: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be16 @@ got int @@
include/linux/mfd/ntxec.h:31:22: sparse: expected restricted __be16
include/linux/mfd/ntxec.h:31:22: sparse: got int
include/linux/mfd/ntxec.h:31:22: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be16 @@ got int @@
include/linux/mfd/ntxec.h:31:22: sparse: expected restricted __be16
include/linux/mfd/ntxec.h:31:22: sparse: got int
vim +91 drivers/rtc/rtc-ntxec.c
78
79 static int ntxec_set_time(struct device *dev, struct rtc_time *tm)
80 {
81 struct ntxec_rtc *rtc = dev_get_drvdata(dev);
82
83 /*
84 * To avoid time overflows while we're writing the full date/time,
85 * set the seconds field to zero before doing anything else. For the
86 * next 59 seconds (plus however long it takes until the RTC's next
87 * update of the second field), the seconds field will not overflow
88 * into the other fields.
89 */
90 struct reg_sequence regs[] = {
> 91 { NTXEC_REG_WRITE_SECOND, ntxec_reg8(0) },
92 { NTXEC_REG_WRITE_YEAR, ntxec_reg8(tm->tm_year - 100) },
93 { NTXEC_REG_WRITE_MONTH, ntxec_reg8(tm->tm_mon + 1) },
94 { NTXEC_REG_WRITE_DAY, ntxec_reg8(tm->tm_mday) },
95 { NTXEC_REG_WRITE_HOUR, ntxec_reg8(tm->tm_hour) },
96 { NTXEC_REG_WRITE_MINUTE, ntxec_reg8(tm->tm_min) },
97 { NTXEC_REG_WRITE_SECOND, ntxec_reg8(tm->tm_sec) },
98 };
99
100 return regmap_multi_reg_write(rtc->ec->regmap, regs, ARRAY_SIZE(regs));
101 }
102
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
[sashal-stable:pending-4.14 20972/22074] arch/arc/kernel/signal.c:80:31: sparse: sparse: incorrect type in argument 1 (different address spaces)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git pending-4.14
head: e578a1979e89497c3b0250d13148b473342c6208
commit: 1c3e3f6d88437844e2edd22e4d1ae074bac7e352 [20972/22074] ARCv2: save ABI registers across signal handling
config: arc-randconfig-s032-20211014 (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/c...
git remote add sashal-stable https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
git fetch --no-tags sashal-stable pending-4.14
git checkout 1c3e3f6d88437844e2edd22e4d1ae074bac7e352
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> arch/arc/kernel/signal.c:80:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] <asn:1> *to @@ got struct user_regs_arcv2 * @@
arch/arc/kernel/signal.c:80:31: sparse: expected void [noderef] <asn:1> *to
arch/arc/kernel/signal.c:80:31: sparse: got struct user_regs_arcv2 *
>> arch/arc/kernel/signal.c:91:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got struct user_regs_arcv2 * @@
arch/arc/kernel/signal.c:91:41: sparse: expected void const [noderef] <asn:1> *from
arch/arc/kernel/signal.c:91:41: sparse: got struct user_regs_arcv2 *
>> arch/arc/kernel/signal.c:137:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct sigcontext *mctx @@ got struct sigcontext [noderef] <asn:1> * @@
arch/arc/kernel/signal.c:137:42: sparse: expected struct sigcontext *mctx
arch/arc/kernel/signal.c:137:42: sparse: got struct sigcontext [noderef] <asn:1> *
arch/arc/kernel/signal.c:156:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct sigcontext *mctx @@ got struct sigcontext [noderef] <asn:1> * @@
arch/arc/kernel/signal.c:156:45: sparse: expected struct sigcontext *mctx
arch/arc/kernel/signal.c:156:45: sparse: got struct sigcontext [noderef] <asn:1> *
arch/arc/kernel/signal.c:197:1: sparse: sparse: symbol 'sys_rt_sigreturn' was not declared. Should it be static?
arch/arc/kernel/signal.c:404:6: sparse: sparse: symbol 'do_signal' was not declared. Should it be static?
In file included from include/asm-generic/bug.h:5,
from arch/arc/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/signal.h:5,
from arch/arc/kernel/signal.c:50:
include/linux/atomic.h: In function 'atomic_inc_unless_negative':
include/linux/compiler.h:25:39: warning: ignoring attribute 'section ("_ftrace_annotated_branch")' because it conflicts with previous 'section ("_ftrace_branch")' [-Wattributes]
25 | static struct ftrace_likely_data 24- | ^~~~~~~~~~~~~~~~~~
include/linux/compiler.h:69:30: note: in definition of macro '__trace_if'
69 | ______r = !!(cond); 27- | ^~~~
include/linux/atomic.h:612:17: note: in expansion of macro 'if'
612 | if (likely(v1 == v))
| ^~
include/linux/compiler.h:45:26: note: in expansion of macro '__branch_check__'
45 | # define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x)))
| ^~~~~~~~~~~~~~~~
include/linux/atomic.h:612:21: note: in expansion of macro 'likely'
612 | if (likely(v1 == v))
| ^~~~~~
include/linux/compiler.h:64:25: note: previous declaration here
64 | ______f = { 39- | ^~~~~~~
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
56 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
| ^~~~~~~~~~
include/linux/atomic.h:612:17: note: in expansion of macro 'if'
612 | if (likely(v1 == v))
| ^~
include/linux/atomic.h: In function 'atomic_dec_unless_positive':
include/linux/compiler.h:25:39: warning: ignoring attribute 'section ("_ftrace_annotated_branch")' because it conflicts with previous 'section ("_ftrace_branch")' [-Wattributes]
25 | static struct ftrace_likely_data 49- | ^~~~~~~~~~~~~~~~~~
include/linux/compiler.h:69:30: note: in definition of macro '__trace_if'
69 | ______r = !!(cond); 52- | ^~~~
include/linux/atomic.h:625:17: note: in expansion of macro 'if'
625 | if (likely(v1 == v))
| ^~
include/linux/compiler.h:45:26: note: in expansion of macro '__branch_check__'
45 | # define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x)))
| ^~~~~~~~~~~~~~~~
include/linux/atomic.h:625:21: note: in expansion of macro 'likely'
625 | if (likely(v1 == v))
| ^~~~~~
include/linux/compiler.h:64:25: note: previous declaration here
64 | ______f = { 64- | ^~~~~~~
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
56 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
| ^~~~~~~~~~
include/linux/atomic.h:625:17: note: in expansion of macro 'if'
625 | if (likely(v1 == v))
| ^~
include/linux/atomic.h: In function 'atomic_dec_if_positive':
include/linux/compiler.h:25:39: warning: ignoring attribute 'section ("_ftrace_annotated_branch")' because it conflicts with previous 'section ("_ftrace_branch")' [-Wattributes]
25 | static struct ftrace_likely_data 74- | ^~~~~~~~~~~~~~~~~~
include/linux/compiler.h:69:30: note: in definition of macro '__trace_if'
69 | ______r = !!(cond); 77- | ^~~~
include/linux/atomic.h:646:17: note: in expansion of macro 'if'
646 | if (unlikely(dec < 0))
| ^~
include/linux/compiler.h:48:26: note: in expansion of macro '__branch_check__'
48 | # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
| ^~~~~~~~~~~~~~~~
include/linux/atomic.h:646:21: note: in expansion of macro 'unlikely'
646 | if (unlikely(dec < 0))
| ^~~~~~~~
include/linux/compiler.h:64:25: note: previous declaration here
64 | ______f = { 89- | ^~~~~~~
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
56 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
| ^~~~~~~~~~
include/linux/atomic.h:646:17: note: in expansion of macro 'if'
646 | if (unlikely(dec < 0))
| ^~
include/linux/compiler.h:25:39: warning: ignoring attribute 'section ("_ftrace_annotated_branch")' because it conflicts with previous 'section ("_ftrace_branch")' [-Wattributes]
25 | static struct ftrace_likely_data 98- | ^~~~~~~~~~~~~~~~~~
include/linux/compiler.h:69:30: note: in definition of macro '__trace_if'
69 | ______r = !!(cond); 101- | ^~~~
include/linux/atomic.h:649:17: note: in expansion of macro 'if'
649 | if (likely(old == c))
| ^~
include/linux/compiler.h:45:26: note: in expansion of macro '__branch_check__'
45 | # define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x)))
| ^~~~~~~~~~~~~~~~
vim +80 arch/arc/kernel/signal.c
66
67 static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
68 {
69 int err = 0;
70 #ifndef CONFIG_ISA_ARCOMPACT
71 struct user_regs_arcv2 v2abi;
72
73 v2abi.r30 = regs->r30;
74 #ifdef CONFIG_ARC_HAS_ACCL_REGS
75 v2abi.r58 = regs->r58;
76 v2abi.r59 = regs->r59;
77 #else
78 v2abi.r58 = v2abi.r59 = 0;
79 #endif
> 80 err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
81 #endif
82 return err;
83 }
84
85 static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
86 {
87 int err = 0;
88 #ifndef CONFIG_ISA_ARCOMPACT
89 struct user_regs_arcv2 v2abi;
90
> 91 err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
92
93 regs->r30 = v2abi.r30;
94 #ifdef CONFIG_ARC_HAS_ACCL_REGS
95 regs->r58 = v2abi.r58;
96 regs->r59 = v2abi.r59;
97 #endif
98 #endif
99 return err;
100 }
101
102 static int
103 stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
104 sigset_t *set)
105 {
106 int err;
107 struct user_regs_struct uregs;
108
109 uregs.scratch.bta = regs->bta;
110 uregs.scratch.lp_start = regs->lp_start;
111 uregs.scratch.lp_end = regs->lp_end;
112 uregs.scratch.lp_count = regs->lp_count;
113 uregs.scratch.status32 = regs->status32;
114 uregs.scratch.ret = regs->ret;
115 uregs.scratch.blink = regs->blink;
116 uregs.scratch.fp = regs->fp;
117 uregs.scratch.gp = regs->r26;
118 uregs.scratch.r12 = regs->r12;
119 uregs.scratch.r11 = regs->r11;
120 uregs.scratch.r10 = regs->r10;
121 uregs.scratch.r9 = regs->r9;
122 uregs.scratch.r8 = regs->r8;
123 uregs.scratch.r7 = regs->r7;
124 uregs.scratch.r6 = regs->r6;
125 uregs.scratch.r5 = regs->r5;
126 uregs.scratch.r4 = regs->r4;
127 uregs.scratch.r3 = regs->r3;
128 uregs.scratch.r2 = regs->r2;
129 uregs.scratch.r1 = regs->r1;
130 uregs.scratch.r0 = regs->r0;
131 uregs.scratch.sp = regs->sp;
132
133 err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
134 sizeof(sf->uc.uc_mcontext.regs.scratch));
135
136 if (is_isa_arcv2())
> 137 err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
138
139 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
140
141 return err ? -EFAULT : 0;
142 }
143
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
Re: [PATCH v2 2/2] net: ethernet: Add driver for Sunplus SP7021
by kernel test robot
Hi Wells,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on net/master robh/for-next linus/master v5.15 next-20211112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Wells-Lu/devicetree-bindings-net...
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git cc0356d6a02e064387c16a83cb96fe43ef33181e
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/67fef21f20f9dd81655eb490c5fa41c07...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wells-Lu/devicetree-bindings-net-Add-bindings-doc-for-Sunplus-SP7021/20211111-180647
git checkout 67fef21f20f9dd81655eb490c5fa41c075f4af3d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/sunplus/sp_driver.c:200:7: error: no previous prototype for 'sp7021_otp_read_mac' [-Werror=missing-prototypes]
200 | char *sp7021_otp_read_mac(struct device *dev, ssize_t *len, char *name)
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
vim +/sp7021_otp_read_mac +200 drivers/net/ethernet/sunplus/sp_driver.c
199
> 200 char *sp7021_otp_read_mac(struct device *dev, ssize_t *len, char *name)
201 {
202 char *ret = NULL;
203 struct nvmem_cell *cell = nvmem_cell_get(dev, name);
204
205 if (IS_ERR_OR_NULL(cell)) {
206 dev_err(dev, "OTP %s read failure: %ld", name, PTR_ERR(cell));
207 return NULL;
208 }
209
210 ret = nvmem_cell_read(cell, len);
211 nvmem_cell_put(cell);
212 dev_dbg(dev, "%zd bytes are read from OTP %s.", *len, name);
213
214 return ret;
215 }
216
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
[rppt:pks/v0.0 18/27] include/asm-generic/pgalloc.h:64:9: error: implicit declaration of function 'free_table'; did you mean 'free_task'?
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git pks/v0.0
head: eed09ce6622d550ab5b10a86e7dd6c2ff6bd59d9
commit: 32e6645b0f3c84ee6e8d9a5566dffa5003821e37 [18/27] x86, mm: Protect page tables with PKS
config: arm64-randconfig-r025-20211103 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git/commit/?id...
git remote add rppt https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git
git fetch --no-tags rppt pks/v0.0
git checkout 32e6645b0f3c84ee6e8d9a5566dffa5003821e37
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/arm64/include/asm/pgalloc.h:17,
from arch/arm64/include/asm/kvm_mmu.h:114,
from arch/arm64/kernel/smp.c:44:
include/asm-generic/pgalloc.h: In function 'pte_free_kernel':
>> include/asm-generic/pgalloc.h:64:9: error: implicit declaration of function 'free_table'; did you mean 'free_task'? [-Werror=implicit-function-declaration]
64 | free_table(virt_to_page(pte));
| ^~~~~~~~~~
| free_task
cc1: some warnings being treated as errors
vim +64 include/asm-generic/pgalloc.h
5fba4af4456b5d Mike Rapoport 2019-07-11 56
5fba4af4456b5d Mike Rapoport 2019-07-11 57 /**
5fba4af4456b5d Mike Rapoport 2019-07-11 58 * pte_free_kernel - free PTE-level kernel page table page
5fba4af4456b5d Mike Rapoport 2019-07-11 59 * @mm: the mm_struct of the current context
5fba4af4456b5d Mike Rapoport 2019-07-11 60 * @pte: pointer to the memory containing the page table
5fba4af4456b5d Mike Rapoport 2019-07-11 61 */
5fba4af4456b5d Mike Rapoport 2019-07-11 62 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
5fba4af4456b5d Mike Rapoport 2019-07-11 63 {
42999ce092b58f Rick Edgecombe 2021-05-04 @64 free_table(virt_to_page(pte));
5fba4af4456b5d Mike Rapoport 2019-07-11 65 }
5fba4af4456b5d Mike Rapoport 2019-07-11 66
:::::: The code at line 64 was first introduced by commit
:::::: 42999ce092b58fa8310c49a262c00700e947ac40 x86, mm: Use cache of page tables
:::::: TO: Rick Edgecombe <rick.p.edgecombe(a)intel.com>
:::::: CC: Mike Rapoport <rppt(a)linux.ibm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
[rppt:pks/v0.0 10/27] lib/pks/pks_test.c:154: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git pks/v0.0
head: eed09ce6622d550ab5b10a86e7dd6c2ff6bd59d9
commit: 79a4c0d7e9449140c2ec65703a0f3b38f4d28aad [10/27] x86/pks: Add PKS test code
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git/commit/?id...
git remote add rppt https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git
git fetch --no-tags rppt pks/v0.0
git checkout 79a4c0d7e9449140c2ec65703a0f3b38f4d28aad
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> lib/pks/pks_test.c:154: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* pks_test_callback() is exported so that the fault handler can detect
vim +154 lib/pks/pks_test.c
152
153 /**
> 154 * pks_test_callback() is exported so that the fault handler can detect
155 * and report back status of intentional faults.
156 *
157 * NOTE: It clears the protection key from the page such that the fault handler
158 * will not re-trigger.
159 */
160 bool pks_test_callback(struct pt_regs *regs)
161 {
162 struct extended_pt_regs *ept_regs = extended_pt_regs(regs);
163 bool armed = (test_armed_key != 0);
164
165 if (test_exception_ctx) {
166 check_exception(ept_regs->thread_pkrs);
167 /*
168 * Stop this check directly within the exception because the
169 * fault handler clean up code will call again while checking
170 * the PMD entry and there is no need to check this again.
171 */
172 test_exception_ctx = NULL;
173 }
174
175 if (armed) {
176 /* Enable read and write to stop faults */
177 ept_regs->thread_pkrs = update_pkey_val(ept_regs->thread_pkrs,
178 test_armed_key, 0);
179 fault_cnt++;
180 }
181
182 return armed;
183 }
184
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
Re: [PATCH v2] prctl: PR_SET_MM - unify copying of user's auvx
by kernel test robot
Hi Cyrill,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on v5.15]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Cyrill-Gorcunov/prctl-PR_SET_MM-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5816b3e6577eaa676ceb00a848f0fd65fe2adc29
config: parisc-randconfig-s032-20210929 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/37297835c68662e1781118a01b7a27127...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cyrill-Gorcunov/prctl-PR_SET_MM-unify-copying-of-user-s-auvx/20210929-123259
git checkout 37297835c68662e1781118a01b7a271277e965d0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> kernel/sys.c:1997:58: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void const [noderef] __user *addr @@ got unsigned long long [usertype] *[addressable] auxv @@
kernel/sys.c:1997:58: sparse: expected void const [noderef] __user *addr
kernel/sys.c:1997:58: sparse: got unsigned long long [usertype] *[addressable] auxv
kernel/sys.c:1068:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p1 @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/sys.c:1068:32: sparse: expected struct task_struct *p1
kernel/sys.c:1068:32: sparse: got struct task_struct [noderef] __rcu *real_parent
kernel/sys.c: note: in included file (through include/linux/rcuwait.h, include/linux/percpu-rwsem.h, include/linux/fs.h, ...):
include/linux/sched/signal.h:710:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:710:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:710:37: sparse: got struct spinlock [noderef] __rcu *
vim +1997 kernel/sys.c
1968
1969 #ifdef CONFIG_CHECKPOINT_RESTORE
1970 static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data_size)
1971 {
1972 struct prctl_mm_map prctl_map = { .exe_fd = (u32)-1, };
1973 unsigned long user_auxv[AT_VECTOR_SIZE];
1974 struct mm_struct *mm = current->mm;
1975 int error;
1976
1977 BUILD_BUG_ON(sizeof(user_auxv) != sizeof(mm->saved_auxv));
1978 BUILD_BUG_ON(sizeof(struct prctl_mm_map) > 256);
1979
1980 if (opt == PR_SET_MM_MAP_SIZE)
1981 return put_user((unsigned int)sizeof(prctl_map),
1982 (unsigned int __user *)addr);
1983
1984 if (data_size != sizeof(prctl_map))
1985 return -EINVAL;
1986
1987 if (copy_from_user(&prctl_map, addr, sizeof(prctl_map)))
1988 return -EFAULT;
1989
1990 error = validate_prctl_map_addr(&prctl_map);
1991 if (error)
1992 return error;
1993
1994 if (prctl_map.auxv_size) {
1995 int error = copy_auxv_from_user(user_auxv,
1996 sizeof(user_auxv),
> 1997 prctl_map.auxv,
1998 prctl_map.auxv_size);
1999 if (error)
2000 return error;
2001 }
2002
2003 if (prctl_map.exe_fd != (u32)-1) {
2004 /*
2005 * Check if the current user is checkpoint/restore capable.
2006 * At the time of this writing, it checks for CAP_SYS_ADMIN
2007 * or CAP_CHECKPOINT_RESTORE.
2008 * Note that a user with access to ptrace can masquerade an
2009 * arbitrary program as any executable, even setuid ones.
2010 * This may have implications in the tomoyo subsystem.
2011 */
2012 if (!checkpoint_restore_ns_capable(current_user_ns()))
2013 return -EPERM;
2014
2015 error = prctl_set_mm_exe_file(mm, prctl_map.exe_fd);
2016 if (error)
2017 return error;
2018 }
2019
2020 /*
2021 * arg_lock protects concurrent updates but we still need mmap_lock for
2022 * read to exclude races with sys_brk.
2023 */
2024 mmap_read_lock(mm);
2025
2026 /*
2027 * We don't validate if these members are pointing to
2028 * real present VMAs because application may have correspond
2029 * VMAs already unmapped and kernel uses these members for statistics
2030 * output in procfs mostly, except
2031 *
2032 * - @start_brk/@brk which are used in do_brk_flags but kernel lookups
2033 * for VMAs when updating these members so anything wrong written
2034 * here cause kernel to swear at userspace program but won't lead
2035 * to any problem in kernel itself
2036 */
2037
2038 spin_lock(&mm->arg_lock);
2039 mm->start_code = prctl_map.start_code;
2040 mm->end_code = prctl_map.end_code;
2041 mm->start_data = prctl_map.start_data;
2042 mm->end_data = prctl_map.end_data;
2043 mm->start_brk = prctl_map.start_brk;
2044 mm->brk = prctl_map.brk;
2045 mm->start_stack = prctl_map.start_stack;
2046 mm->arg_start = prctl_map.arg_start;
2047 mm->arg_end = prctl_map.arg_end;
2048 mm->env_start = prctl_map.env_start;
2049 mm->env_end = prctl_map.env_end;
2050 spin_unlock(&mm->arg_lock);
2051
2052 /*
2053 * Note this update of @saved_auxv is lockless thus
2054 * if someone reads this member in procfs while we're
2055 * updating -- it may get partly updated results. It's
2056 * known and acceptable trade off: we leave it as is to
2057 * not introduce additional locks here making the kernel
2058 * more complex.
2059 */
2060 if (prctl_map.auxv_size)
2061 memcpy(mm->saved_auxv, user_auxv, sizeof(user_auxv));
2062
2063 mmap_read_unlock(mm);
2064 return 0;
2065 }
2066 #endif /* CONFIG_CHECKPOINT_RESTORE */
2067
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week