drivers/net/ethernet/amd/amd8111e.c:107 amd8111e_read_phy() warn: this loop depends on readl() succeeding

kernel test robot
2020-08-14T00:03:13Z

[-- Attachment #1: Type: text/plain, Size: 8801 bytes --]

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 990f227371a400c0fbcb98b75c91a7dbd65f6132
commit: 05933aac7b11911955de307a329dc2a7a14b7bd0 ia64: remove now unused machvec indirections
date: 12 months ago
config: ia64-randconfig-m031-20200811 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

New smatch warnings:
drivers/net/ethernet/amd/amd8111e.c:107 amd8111e_read_phy() warn: this loop depends on readl() succeeding
drivers/net/ethernet/amd/amd8111e.c:136 amd8111e_write_phy() warn: this loop depends on readl() succeeding
drivers/scsi/megaraid.c:1224 issue_scb_block() warn: this loop depends on readl() succeeding
drivers/scsi/megaraid.c:1382 megaraid_isr_memmapped() warn: this loop depends on readl() succeeding
drivers/scsi/arcmsr/arcmsr_hba.c:2289 arcmsr_hbaA_doorbell_isr() warn: this loop depends on readl() succeeding
drivers/scsi/arcmsr/arcmsr_hba.c:2315 arcmsr_hbaC_doorbell_isr() warn: this loop depends on readl() succeeding
drivers/scsi/arcmsr/arcmsr_hba.c:2335 arcmsr_hbaD_doorbell_isr() warn: this loop depends on readl() succeeding
drivers/scsi/arcmsr/arcmsr_hba.c:2654 arcmsr_hbaC_handle_isr() warn: this loop depends on readl() succeeding
drivers/scsi/arcmsr/arcmsr_hba.c:2679 arcmsr_hbaD_handle_isr() warn: this loop depends on readl() succeeding
drivers/scsi/arcmsr/arcmsr_hba.c:2704 arcmsr_hbaE_handle_isr() warn: this loop depends on readl() succeeding
drivers/scsi/arcmsr/arcmsr_hba.c:3492 arcmsr_hbaC_polling_ccbdone() warn: this loop depends on readl() succeeding

Old smatch warnings:
drivers/scsi/megaraid.c:3106 megadev_ioctl() error: buffer overflow 'hba_soft_state' 32 <= 27904
drivers/scsi/megaraid.c:3318 megadev_ioctl() error: uninitialized symbol 'data_dma_hndl'.
drivers/scsi/arcmsr/arcmsr_hba.c:1403 arcmsr_drain_donequeue() warn: inconsistent indenting
drivers/scsi/arcmsr/arcmsr_hba.c:3479 arcmsr_hbaC_polling_ccbdone() warn: inconsistent indenting

vim +107 drivers/net/ethernet/amd/amd8111e.c

^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 97
13a4fa43bff03b7 drivers/net/ethernet/amd/amd8111e.c Varka Bhadram 2014-07-14 98 /* This function will read the PHY registers. */
46c73ecc6168586 drivers/net/ethernet/amd/amd8111e.c Varka Bhadram 2014-07-14 99 static int amd8111e_read_phy(struct amd8111e_priv *lp,
46c73ecc6168586 drivers/net/ethernet/amd/amd8111e.c Varka Bhadram 2014-07-14 100 int phy_id, int reg, u32 *val)
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 101 {
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 102 void __iomem *mmio = lp->mmio;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 103 unsigned int reg_val;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 104 unsigned int repeat= REPEAT_CNT;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 105
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 106 reg_val = readl(mmio + PHY_ACCESS);
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 @107 while (reg_val & PHY_CMD_ACTIVE)
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 108 reg_val = readl( mmio + PHY_ACCESS );
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 109
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 110 writel( PHY_RD_CMD | ((phy_id & 0x1f) << 21) |
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 111 ((reg & 0x1f) << 16), mmio +PHY_ACCESS);
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 112 do{
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 113 reg_val = readl(mmio + PHY_ACCESS);
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 114 udelay(30); /* It takes 30 us to read/write data */
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 115 } while (--repeat && (reg_val & PHY_CMD_ACTIVE));
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 116 if(reg_val & PHY_RD_ERR)
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 117 goto err_phy_read;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 118
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 119 *val = reg_val & 0xffff;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 120 return 0;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 121 err_phy_read:
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 122 *val = 0;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 123 return -EINVAL;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 124
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 125 }
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 126
13a4fa43bff03b7 drivers/net/ethernet/amd/amd8111e.c Varka Bhadram 2014-07-14 127 /* This function will write into PHY registers. */
46c73ecc6168586 drivers/net/ethernet/amd/amd8111e.c Varka Bhadram 2014-07-14 128 static int amd8111e_write_phy(struct amd8111e_priv *lp,
46c73ecc6168586 drivers/net/ethernet/amd/amd8111e.c Varka Bhadram 2014-07-14 129 int phy_id, int reg, u32 val)
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 130 {
632155e65944968 drivers/net/amd8111e.c Yoann Padioleau 2007-06-01 131 unsigned int repeat = REPEAT_CNT;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 132 void __iomem *mmio = lp->mmio;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 133 unsigned int reg_val;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 134
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 135 reg_val = readl(mmio + PHY_ACCESS);
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 @136 while (reg_val & PHY_CMD_ACTIVE)
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 137 reg_val = readl( mmio + PHY_ACCESS );
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 138
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 139 writel( PHY_WR_CMD | ((phy_id & 0x1f) << 21) |
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 140 ((reg & 0x1f) << 16)|val, mmio + PHY_ACCESS);
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 141
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 142 do{
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 143 reg_val = readl(mmio + PHY_ACCESS);
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 144 udelay(30); /* It takes 30 us to read/write the data */
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 145 } while (--repeat && (reg_val & PHY_CMD_ACTIVE));
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 146
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 147 if(reg_val & PHY_RD_ERR)
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 148 goto err_phy_write;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 149
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 150 return 0;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 151
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 152 err_phy_write:
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 153 return -EINVAL;
^1da177e4c3f415 drivers/net/amd8111e.c Linus Torvalds 2005-04-16 154

:::::: The code at line 107 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31123 bytes --]