CC: [email protected] CC: [email protected] CC: [email protected] TO: Qing Zhang <[email protected]> CC: Jiaxun Yang <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 58e1100fdc5990b0cc0d4beaf2562a92e621ac7d commit: 30bba69d7db40e732d6c0aa6d4890c60d717e314 stmmac: pci: Add dwmac support for Loongson date: 6 months ago :::::: branch date: 25 hours ago :::::: commit date: 6 months ago config: i386-randconfig-c001-20211130 (https://download.01.org/0day-ci/archive/20211202/[email protected]/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 25eb7fa01d7ebbe67648ea03841cda55b4239ab2) 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/?id=30bba69d7db40e732d6c0aa6d4890c60d717e314 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 30bba69d7db40e732d6c0aa6d4890c60d717e314 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:873:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:873:21: note: Value stored to 'client' during its initialization is never read struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:949:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:949:21: note: Value stored to 'client' during its initialization is never read struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:967:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:967:21: note: Value stored to 'client' during its initialization is never read struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:986:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ drivers/media/dvb-frontends/af9033.c:986:21: note: Value stored to 'client' during its initialization is never read struct i2c_client *client = dev->client; ^~~~~~ ~~~~~~~~~~~ Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 15 warnings generated. Suppressed 15 warnings (15 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 15 warnings generated. Suppressed 15 warnings (15 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 13 warnings generated. Suppressed 13 warnings (13 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 15 warnings generated. Suppressed 15 warnings (15 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 15 warnings generated. Suppressed 15 warnings (15 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 15 warnings generated. Suppressed 15 warnings (15 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 19 warnings generated. drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:76:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch] if (mdio) { ^~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:52:14: note: 'mdio' declared without an initial value int ret, i, mdio; ^~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:55:7: note: Calling 'dev_of_node' np = dev_of_node(&pdev->dev); ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/device.h:769:6: note: Left side of '||' is false if (!IS_ENABLED(CONFIG_OF) || !dev) ^ include/linux/device.h:769:32: note: Assuming 'dev' is non-null, which participates in a condition later if (!IS_ENABLED(CONFIG_OF) || !dev) ^~~~ include/linux/device.h:769:2: note: Taking false branch if (!IS_ENABLED(CONFIG_OF) || !dev) ^ include/linux/device.h:771:2: note: Returning without writing to 'dev->of_node', which participates in a condition later return dev->of_node; ^ include/linux/device.h:771:2: note: Returning pointer, which participates in a condition later return dev->of_node; ^~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:55:7: note: Returning from 'dev_of_node' np = dev_of_node(&pdev->dev); ^~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:57:6: note: Assuming 'np' is non-null if (!np) { ^~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:57:2: note: Taking false branch if (!np) { ^ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:62:6: note: Assuming the condition is false if (!of_device_is_compatible(np, "loongson, pci-gmac")) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:62:2: note: Taking false branch if (!of_device_is_compatible(np, "loongson, pci-gmac")) { ^ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:68:6: note: Assuming 'plat' is non-null if (!plat) ^~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:68:2: note: Taking false branch if (!plat) ^ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:71:6: note: Assuming field 'mdio_node' is null if (plat->mdio_node) { ^~~~~~~~~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:71:2: note: Taking false branch if (plat->mdio_node) { ^ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:76:6: note: Branch condition evaluates to a garbage value if (mdio) { ^~~~ >> drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:126:3: warning: Value >> stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] ret = -ENODEV; ^ ~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:126:3: note: Value stored to 'ret' is never read ret = -ENODEV; ^ ~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:138:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] ret = -ENODEV; ^ ~~~~~~~ drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:138:3: note: Value stored to 'ret' is never read ret = -ENODEV; ^ ~~~~~~~ Suppressed 16 warnings (15 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. Suppressed 8 warnings (8 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. Suppressed 8 warnings (8 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. drivers/hwmon/pmbus/zl6100.c:115:41: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult] return (mantissa & 0x7ff) | ((exponent << 11) & 0xf800); ^ drivers/hwmon/pmbus/zl6100.c:230:29: note: Left side of '&&' is false struct zl6100_data *data = to_zl6100_data(info); ^ drivers/hwmon/pmbus/zl6100.c:30:28: note: expanded from macro 'to_zl6100_data' #define to_zl6100_data(x) container_of(x, struct zl6100_data, info) ^ include/linux/kernel.h:716:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/hwmon/pmbus/zl6100.c:230:29: note: Taking false branch struct zl6100_data *data = to_zl6100_data(info); ^ drivers/hwmon/pmbus/zl6100.c:30:28: note: expanded from macro 'to_zl6100_data' #define to_zl6100_data(x) container_of(x, struct zl6100_data, info) ^ include/linux/kernel.h:716:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/hwmon/pmbus/zl6100.c:230:29: note: Loop condition is false. Exiting loop struct zl6100_data *data = to_zl6100_data(info); ^ drivers/hwmon/pmbus/zl6100.c:30:28: note: expanded from macro 'to_zl6100_data' #define to_zl6100_data(x) container_of(x, struct zl6100_data, info) ^ include/linux/kernel.h:716:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/hwmon/pmbus/zl6100.c:233:6: note: Assuming 'page' is <= 0 if (page > 0) ^~~~~~~~ drivers/hwmon/pmbus/zl6100.c:233:2: note: Taking false branch if (page > 0) ^ drivers/hwmon/pmbus/zl6100.c:236:2: note: Control jumps to 'case PMBUS_VIRT_VMON_UV_WARN_LIMIT:' at line 246 switch (reg) { ^ drivers/hwmon/pmbus/zl6100.c:247:21: note: Left side of '||' is false word = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(word) * 10, 11)); ^ include/linux/math.h:89:3: note: expanded from macro 'DIV_ROUND_CLOSEST' (((typeof(x))-1) > 0 || \ ^ drivers/hwmon/pmbus/zl6100.c:247:21: note: Left side of '||' is false word = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(word) * 10, 11)); ^ include/linux/math.h:89:3: note: expanded from macro 'DIV_ROUND_CLOSEST' (((typeof(x))-1) > 0 || \ ^ drivers/hwmon/pmbus/zl6100.c:247:21: note: Assuming '__x' is <= 0 word = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(word) * 10, 11)); ^ include/linux/math.h:91:5: note: expanded from macro 'DIV_ROUND_CLOSEST' (((__x) > 0) == ((__d) > 0))) ? \ vim +/ret +126 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c 30bba69d7db40e7 Qing Zhang 2021-06-18 47 30bba69d7db40e7 Qing Zhang 2021-06-18 48 static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id) 30bba69d7db40e7 Qing Zhang 2021-06-18 49 { 30bba69d7db40e7 Qing Zhang 2021-06-18 50 struct plat_stmmacenet_data *plat; 30bba69d7db40e7 Qing Zhang 2021-06-18 51 struct stmmac_resources res; 30bba69d7db40e7 Qing Zhang 2021-06-18 52 int ret, i, mdio; 30bba69d7db40e7 Qing Zhang 2021-06-18 53 struct device_node *np; 30bba69d7db40e7 Qing Zhang 2021-06-18 54 30bba69d7db40e7 Qing Zhang 2021-06-18 55 np = dev_of_node(&pdev->dev); 30bba69d7db40e7 Qing Zhang 2021-06-18 56 30bba69d7db40e7 Qing Zhang 2021-06-18 57 if (!np) { 30bba69d7db40e7 Qing Zhang 2021-06-18 58 pr_info("dwmac_loongson_pci: No OF node\n"); 30bba69d7db40e7 Qing Zhang 2021-06-18 59 return -ENODEV; 30bba69d7db40e7 Qing Zhang 2021-06-18 60 } 30bba69d7db40e7 Qing Zhang 2021-06-18 61 30bba69d7db40e7 Qing Zhang 2021-06-18 62 if (!of_device_is_compatible(np, "loongson, pci-gmac")) { 30bba69d7db40e7 Qing Zhang 2021-06-18 63 pr_info("dwmac_loongson_pci: Incompatible OF node\n"); 30bba69d7db40e7 Qing Zhang 2021-06-18 64 return -ENODEV; 30bba69d7db40e7 Qing Zhang 2021-06-18 65 } 30bba69d7db40e7 Qing Zhang 2021-06-18 66 30bba69d7db40e7 Qing Zhang 2021-06-18 67 plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); 30bba69d7db40e7 Qing Zhang 2021-06-18 68 if (!plat) 30bba69d7db40e7 Qing Zhang 2021-06-18 69 return -ENOMEM; 30bba69d7db40e7 Qing Zhang 2021-06-18 70 30bba69d7db40e7 Qing Zhang 2021-06-18 71 if (plat->mdio_node) { 30bba69d7db40e7 Qing Zhang 2021-06-18 72 dev_err(&pdev->dev, "Found MDIO subnode\n"); 30bba69d7db40e7 Qing Zhang 2021-06-18 73 mdio = true; 30bba69d7db40e7 Qing Zhang 2021-06-18 74 } 30bba69d7db40e7 Qing Zhang 2021-06-18 75 30bba69d7db40e7 Qing Zhang 2021-06-18 76 if (mdio) { 30bba69d7db40e7 Qing Zhang 2021-06-18 77 plat->mdio_bus_data = devm_kzalloc(&pdev->dev, 30bba69d7db40e7 Qing Zhang 2021-06-18 78 sizeof(*plat->mdio_bus_data), 30bba69d7db40e7 Qing Zhang 2021-06-18 79 GFP_KERNEL); 30bba69d7db40e7 Qing Zhang 2021-06-18 80 if (!plat->mdio_bus_data) 30bba69d7db40e7 Qing Zhang 2021-06-18 81 return -ENOMEM; 30bba69d7db40e7 Qing Zhang 2021-06-18 82 plat->mdio_bus_data->needs_reset = true; 30bba69d7db40e7 Qing Zhang 2021-06-18 83 } 30bba69d7db40e7 Qing Zhang 2021-06-18 84 30bba69d7db40e7 Qing Zhang 2021-06-18 85 plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg), GFP_KERNEL); 30bba69d7db40e7 Qing Zhang 2021-06-18 86 if (!plat->dma_cfg) 30bba69d7db40e7 Qing Zhang 2021-06-18 87 return -ENOMEM; 30bba69d7db40e7 Qing Zhang 2021-06-18 88 30bba69d7db40e7 Qing Zhang 2021-06-18 89 /* Enable pci device */ 30bba69d7db40e7 Qing Zhang 2021-06-18 90 ret = pci_enable_device(pdev); 30bba69d7db40e7 Qing Zhang 2021-06-18 91 if (ret) { 30bba69d7db40e7 Qing Zhang 2021-06-18 92 dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n", __func__); 30bba69d7db40e7 Qing Zhang 2021-06-18 93 return ret; 30bba69d7db40e7 Qing Zhang 2021-06-18 94 } 30bba69d7db40e7 Qing Zhang 2021-06-18 95 30bba69d7db40e7 Qing Zhang 2021-06-18 96 /* Get the base address of device */ 30bba69d7db40e7 Qing Zhang 2021-06-18 97 for (i = 0; i < PCI_STD_NUM_BARS; i++) { 30bba69d7db40e7 Qing Zhang 2021-06-18 98 if (pci_resource_len(pdev, i) == 0) 30bba69d7db40e7 Qing Zhang 2021-06-18 99 continue; 30bba69d7db40e7 Qing Zhang 2021-06-18 100 ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); 30bba69d7db40e7 Qing Zhang 2021-06-18 101 if (ret) 30bba69d7db40e7 Qing Zhang 2021-06-18 102 return ret; 30bba69d7db40e7 Qing Zhang 2021-06-18 103 break; 30bba69d7db40e7 Qing Zhang 2021-06-18 104 } 30bba69d7db40e7 Qing Zhang 2021-06-18 105 30bba69d7db40e7 Qing Zhang 2021-06-18 106 plat->bus_id = of_alias_get_id(np, "ethernet"); 30bba69d7db40e7 Qing Zhang 2021-06-18 107 if (plat->bus_id < 0) 30bba69d7db40e7 Qing Zhang 2021-06-18 108 plat->bus_id = pci_dev_id(pdev); 30bba69d7db40e7 Qing Zhang 2021-06-18 109 30bba69d7db40e7 Qing Zhang 2021-06-18 110 plat->phy_interface = device_get_phy_mode(&pdev->dev); 30bba69d7db40e7 Qing Zhang 2021-06-18 111 if (plat->phy_interface < 0) 30bba69d7db40e7 Qing Zhang 2021-06-18 112 dev_err(&pdev->dev, "phy_mode not found\n"); 30bba69d7db40e7 Qing Zhang 2021-06-18 113 30bba69d7db40e7 Qing Zhang 2021-06-18 114 plat->interface = PHY_INTERFACE_MODE_GMII; 30bba69d7db40e7 Qing Zhang 2021-06-18 115 30bba69d7db40e7 Qing Zhang 2021-06-18 116 pci_set_master(pdev); 30bba69d7db40e7 Qing Zhang 2021-06-18 117 30bba69d7db40e7 Qing Zhang 2021-06-18 118 loongson_default_data(plat); 30bba69d7db40e7 Qing Zhang 2021-06-18 119 pci_enable_msi(pdev); 30bba69d7db40e7 Qing Zhang 2021-06-18 120 memset(&res, 0, sizeof(res)); 30bba69d7db40e7 Qing Zhang 2021-06-18 121 res.addr = pcim_iomap_table(pdev)[0]; 30bba69d7db40e7 Qing Zhang 2021-06-18 122 30bba69d7db40e7 Qing Zhang 2021-06-18 123 res.irq = of_irq_get_byname(np, "macirq"); 30bba69d7db40e7 Qing Zhang 2021-06-18 124 if (res.irq < 0) { 30bba69d7db40e7 Qing Zhang 2021-06-18 125 dev_err(&pdev->dev, "IRQ macirq not found\n"); 30bba69d7db40e7 Qing Zhang 2021-06-18 @126 ret = -ENODEV; 30bba69d7db40e7 Qing Zhang 2021-06-18 127 } 30bba69d7db40e7 Qing Zhang 2021-06-18 128 30bba69d7db40e7 Qing Zhang 2021-06-18 129 res.wol_irq = of_irq_get_byname(np, "eth_wake_irq"); 30bba69d7db40e7 Qing Zhang 2021-06-18 130 if (res.wol_irq < 0) { 30bba69d7db40e7 Qing Zhang 2021-06-18 131 dev_info(&pdev->dev, "IRQ eth_wake_irq not found, using macirq\n"); 30bba69d7db40e7 Qing Zhang 2021-06-18 132 res.wol_irq = res.irq; 30bba69d7db40e7 Qing Zhang 2021-06-18 133 } 30bba69d7db40e7 Qing Zhang 2021-06-18 134 30bba69d7db40e7 Qing Zhang 2021-06-18 135 res.lpi_irq = of_irq_get_byname(np, "eth_lpi"); 30bba69d7db40e7 Qing Zhang 2021-06-18 136 if (res.lpi_irq < 0) { 30bba69d7db40e7 Qing Zhang 2021-06-18 137 dev_err(&pdev->dev, "IRQ eth_lpi not found\n"); 30bba69d7db40e7 Qing Zhang 2021-06-18 138 ret = -ENODEV; 30bba69d7db40e7 Qing Zhang 2021-06-18 139 } 30bba69d7db40e7 Qing Zhang 2021-06-18 140 30bba69d7db40e7 Qing Zhang 2021-06-18 141 return stmmac_dvr_probe(&pdev->dev, plat, &res); 30bba69d7db40e7 Qing Zhang 2021-06-18 142 } 30bba69d7db40e7 Qing Zhang 2021-06-18 143 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
