[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202209081937.61kRvDnU-lkp@intel.com>
Date: Thu, 8 Sep 2022 20:01:43 +0800
From: kernel test robot <lkp@...el.com>
To: Sun Ke <sunke32@...wei.com>, joyce.ooi@...el.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.or,
pabeni@...hat.com, linux@...linux.org.uk
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] net: ethernet: altera: TSE: fix error return code in
altera_tse_probe()
Hi Sun,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on next-20220908]
[cannot apply to net/master linus/master v6.0-rc4]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sun-Ke/net-ethernet-altera-TSE-fix-error-return-code-in-altera_tse_probe/20220908-150346
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 2018b22a759e26a4c7e3ac6c60c283cfbd2c9c93
config: x86_64-randconfig-a016
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/intel-lab-lkp/linux/commit/077152f4c5342d290cefe00cfcc1b4ceb6c5e967
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sun-Ke/net-ethernet-altera-TSE-fix-error-return-code-in-altera_tse_probe/20220908-150346
git checkout 077152f4c5342d290cefe00cfcc1b4ceb6c5e967
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/ethernet/altera/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/altera/altera_tse_main.c:1414:17: warning: incompatible pointer to integer conversion passing 'struct phylink *' to parameter of type 'long' [-Wint-conversion]
ret = ERR_PTR(priv->phylink);
^~~~~~~~~~~~~
include/linux/err.h:24:48: note: passing argument to parameter 'error' here
static inline void * __must_check ERR_PTR(long error)
^
>> drivers/net/ethernet/altera/altera_tse_main.c:1414:7: warning: incompatible pointer to integer conversion assigning to 'int' from 'void *' [-Wint-conversion]
ret = ERR_PTR(priv->phylink);
^ ~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
vim +1414 drivers/net/ethernet/altera/altera_tse_main.c
1134
1135 /* Probe Altera TSE MAC device
1136 */
1137 static int altera_tse_probe(struct platform_device *pdev)
1138 {
1139 const struct of_device_id *of_id = NULL;
1140 struct altera_tse_private *priv;
1141 struct resource *control_port;
1142 struct resource *dma_res;
1143 struct resource *pcs_res;
1144 struct net_device *ndev;
1145 void __iomem *descmap;
1146 int pcs_reg_width = 2;
1147 int ret = -ENODEV;
1148
1149 ndev = alloc_etherdev(sizeof(struct altera_tse_private));
1150 if (!ndev) {
1151 dev_err(&pdev->dev, "Could not allocate network device\n");
1152 return -ENODEV;
1153 }
1154
1155 SET_NETDEV_DEV(ndev, &pdev->dev);
1156
1157 priv = netdev_priv(ndev);
1158 priv->device = &pdev->dev;
1159 priv->dev = ndev;
1160 priv->msg_enable = netif_msg_init(debug, default_msg_level);
1161
1162 of_id = of_match_device(altera_tse_ids, &pdev->dev);
1163
1164 if (of_id)
1165 priv->dmaops = (struct altera_dmaops *)of_id->data;
1166
1167
1168 if (priv->dmaops &&
1169 priv->dmaops->altera_dtype == ALTERA_DTYPE_SGDMA) {
1170 /* Get the mapped address to the SGDMA descriptor memory */
1171 ret = request_and_map(pdev, "s1", &dma_res, &descmap);
1172 if (ret)
1173 goto err_free_netdev;
1174
1175 /* Start of that memory is for transmit descriptors */
1176 priv->tx_dma_desc = descmap;
1177
1178 /* First half is for tx descriptors, other half for tx */
1179 priv->txdescmem = resource_size(dma_res)/2;
1180
1181 priv->txdescmem_busaddr = (dma_addr_t)dma_res->start;
1182
1183 priv->rx_dma_desc = (void __iomem *)((uintptr_t)(descmap +
1184 priv->txdescmem));
1185 priv->rxdescmem = resource_size(dma_res)/2;
1186 priv->rxdescmem_busaddr = dma_res->start;
1187 priv->rxdescmem_busaddr += priv->txdescmem;
1188
1189 if (upper_32_bits(priv->rxdescmem_busaddr)) {
1190 dev_dbg(priv->device,
1191 "SGDMA bus addresses greater than 32-bits\n");
1192 ret = -EINVAL;
1193 goto err_free_netdev;
1194 }
1195 if (upper_32_bits(priv->txdescmem_busaddr)) {
1196 dev_dbg(priv->device,
1197 "SGDMA bus addresses greater than 32-bits\n");
1198 ret = -EINVAL;
1199 goto err_free_netdev;
1200 }
1201 } else if (priv->dmaops &&
1202 priv->dmaops->altera_dtype == ALTERA_DTYPE_MSGDMA) {
1203 ret = request_and_map(pdev, "rx_resp", &dma_res,
1204 &priv->rx_dma_resp);
1205 if (ret)
1206 goto err_free_netdev;
1207
1208 ret = request_and_map(pdev, "tx_desc", &dma_res,
1209 &priv->tx_dma_desc);
1210 if (ret)
1211 goto err_free_netdev;
1212
1213 priv->txdescmem = resource_size(dma_res);
1214 priv->txdescmem_busaddr = dma_res->start;
1215
1216 ret = request_and_map(pdev, "rx_desc", &dma_res,
1217 &priv->rx_dma_desc);
1218 if (ret)
1219 goto err_free_netdev;
1220
1221 priv->rxdescmem = resource_size(dma_res);
1222 priv->rxdescmem_busaddr = dma_res->start;
1223
1224 } else {
1225 ret = -ENODEV;
1226 goto err_free_netdev;
1227 }
1228
1229 if (!dma_set_mask(priv->device, DMA_BIT_MASK(priv->dmaops->dmamask))) {
1230 dma_set_coherent_mask(priv->device,
1231 DMA_BIT_MASK(priv->dmaops->dmamask));
1232 } else if (!dma_set_mask(priv->device, DMA_BIT_MASK(32))) {
1233 dma_set_coherent_mask(priv->device, DMA_BIT_MASK(32));
1234 } else {
1235 ret = -EIO;
1236 goto err_free_netdev;
1237 }
1238
1239 /* MAC address space */
1240 ret = request_and_map(pdev, "control_port", &control_port,
1241 (void __iomem **)&priv->mac_dev);
1242 if (ret)
1243 goto err_free_netdev;
1244
1245 /* xSGDMA Rx Dispatcher address space */
1246 ret = request_and_map(pdev, "rx_csr", &dma_res,
1247 &priv->rx_dma_csr);
1248 if (ret)
1249 goto err_free_netdev;
1250
1251
1252 /* xSGDMA Tx Dispatcher address space */
1253 ret = request_and_map(pdev, "tx_csr", &dma_res,
1254 &priv->tx_dma_csr);
1255 if (ret)
1256 goto err_free_netdev;
1257
1258 /* SGMII PCS address space. The location can vary depending on how the
1259 * IP is integrated. We can have a resource dedicated to it at a specific
1260 * address space, but if it's not the case, we fallback to the mdiophy0
1261 * from the MAC's address space
1262 */
1263 ret = request_and_map(pdev, "pcs", &pcs_res,
1264 &priv->pcs_base);
1265 if (ret) {
1266 priv->pcs_base = priv->mac_dev + tse_csroffs(mdio_phy0);
1267 pcs_reg_width = 4;
1268 }
1269
1270 /* Rx IRQ */
1271 priv->rx_irq = platform_get_irq_byname(pdev, "rx_irq");
1272 if (priv->rx_irq == -ENXIO) {
1273 dev_err(&pdev->dev, "cannot obtain Rx IRQ\n");
1274 ret = -ENXIO;
1275 goto err_free_netdev;
1276 }
1277
1278 /* Tx IRQ */
1279 priv->tx_irq = platform_get_irq_byname(pdev, "tx_irq");
1280 if (priv->tx_irq == -ENXIO) {
1281 dev_err(&pdev->dev, "cannot obtain Tx IRQ\n");
1282 ret = -ENXIO;
1283 goto err_free_netdev;
1284 }
1285
1286 /* get FIFO depths from device tree */
1287 if (of_property_read_u32(pdev->dev.of_node, "rx-fifo-depth",
1288 &priv->rx_fifo_depth)) {
1289 dev_err(&pdev->dev, "cannot obtain rx-fifo-depth\n");
1290 ret = -ENXIO;
1291 goto err_free_netdev;
1292 }
1293
1294 if (of_property_read_u32(pdev->dev.of_node, "tx-fifo-depth",
1295 &priv->tx_fifo_depth)) {
1296 dev_err(&pdev->dev, "cannot obtain tx-fifo-depth\n");
1297 ret = -ENXIO;
1298 goto err_free_netdev;
1299 }
1300
1301 /* get hash filter settings for this instance */
1302 priv->hash_filter =
1303 of_property_read_bool(pdev->dev.of_node,
1304 "altr,has-hash-multicast-filter");
1305
1306 /* Set hash filter to not set for now until the
1307 * multicast filter receive issue is debugged
1308 */
1309 priv->hash_filter = 0;
1310
1311 /* get supplemental address settings for this instance */
1312 priv->added_unicast =
1313 of_property_read_bool(pdev->dev.of_node,
1314 "altr,has-supplementary-unicast");
1315
1316 priv->dev->min_mtu = ETH_ZLEN + ETH_FCS_LEN;
1317 /* Max MTU is 1500, ETH_DATA_LEN */
1318 priv->dev->max_mtu = ETH_DATA_LEN;
1319
1320 /* Get the max mtu from the device tree. Note that the
1321 * "max-frame-size" parameter is actually max mtu. Definition
1322 * in the ePAPR v1.1 spec and usage differ, so go with usage.
1323 */
1324 of_property_read_u32(pdev->dev.of_node, "max-frame-size",
1325 &priv->dev->max_mtu);
1326
1327 /* The DMA buffer size already accounts for an alignment bias
1328 * to avoid unaligned access exceptions for the NIOS processor,
1329 */
1330 priv->rx_dma_buf_sz = ALTERA_RXDMABUFFER_SIZE;
1331
1332 /* get default MAC address from device tree */
1333 ret = of_get_ethdev_address(pdev->dev.of_node, ndev);
1334 if (ret)
1335 eth_hw_addr_random(ndev);
1336
1337 /* get phy addr and create mdio */
1338 ret = altera_tse_phy_get_addr_mdio_create(ndev);
1339
1340 if (ret)
1341 goto err_free_netdev;
1342
1343 /* initialize netdev */
1344 ndev->mem_start = control_port->start;
1345 ndev->mem_end = control_port->end;
1346 ndev->netdev_ops = &altera_tse_netdev_ops;
1347 altera_tse_set_ethtool_ops(ndev);
1348
1349 altera_tse_netdev_ops.ndo_set_rx_mode = tse_set_rx_mode;
1350
1351 if (priv->hash_filter)
1352 altera_tse_netdev_ops.ndo_set_rx_mode =
1353 tse_set_rx_mode_hashfilter;
1354
1355 /* Scatter/gather IO is not supported,
1356 * so it is turned off
1357 */
1358 ndev->hw_features &= ~NETIF_F_SG;
1359 ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
1360
1361 /* VLAN offloading of tagging, stripping and filtering is not
1362 * supported by hardware, but driver will accommodate the
1363 * extra 4-byte VLAN tag for processing by upper layers
1364 */
1365 ndev->features |= NETIF_F_HW_VLAN_CTAG_RX;
1366
1367 /* setup NAPI interface */
1368 netif_napi_add(ndev, &priv->napi, tse_poll, NAPI_POLL_WEIGHT);
1369
1370 spin_lock_init(&priv->mac_cfg_lock);
1371 spin_lock_init(&priv->tx_lock);
1372 spin_lock_init(&priv->rxdma_irq_lock);
1373
1374 netif_carrier_off(ndev);
1375 ret = register_netdev(ndev);
1376 if (ret) {
1377 dev_err(&pdev->dev, "failed to register TSE net device\n");
1378 goto err_register_netdev;
1379 }
1380
1381 platform_set_drvdata(pdev, ndev);
1382
1383 priv->revision = ioread32(&priv->mac_dev->megacore_revision);
1384
1385 if (netif_msg_probe(priv))
1386 dev_info(&pdev->dev, "Altera TSE MAC version %d.%d at 0x%08lx irq %d/%d\n",
1387 (priv->revision >> 8) & 0xff,
1388 priv->revision & 0xff,
1389 (unsigned long) control_port->start, priv->rx_irq,
1390 priv->tx_irq);
1391
1392 priv->pcs = alt_tse_pcs_create(ndev, priv->pcs_base, pcs_reg_width);
1393
1394 priv->phylink_config.dev = &ndev->dev;
1395 priv->phylink_config.type = PHYLINK_NETDEV;
1396 priv->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 |
1397 MAC_100 | MAC_1000FD;
1398
1399 phy_interface_set_rgmii(priv->phylink_config.supported_interfaces);
1400 __set_bit(PHY_INTERFACE_MODE_MII,
1401 priv->phylink_config.supported_interfaces);
1402 __set_bit(PHY_INTERFACE_MODE_GMII,
1403 priv->phylink_config.supported_interfaces);
1404 __set_bit(PHY_INTERFACE_MODE_SGMII,
1405 priv->phylink_config.supported_interfaces);
1406 __set_bit(PHY_INTERFACE_MODE_1000BASEX,
1407 priv->phylink_config.supported_interfaces);
1408
1409 priv->phylink = phylink_create(&priv->phylink_config,
1410 of_fwnode_handle(priv->device->of_node),
1411 priv->phy_iface, &alt_tse_phylink_ops);
1412 if (IS_ERR(priv->phylink)) {
1413 dev_err(&pdev->dev, "failed to create phylink\n");
> 1414 ret = ERR_PTR(priv->phylink);
1415 goto err_init_phy;
1416 }
1417
1418 return 0;
1419
1420 err_init_phy:
1421 unregister_netdev(ndev);
1422 err_register_netdev:
1423 netif_napi_del(&priv->napi);
1424 altera_tse_mdio_destroy(ndev);
1425 err_free_netdev:
1426 free_netdev(ndev);
1427 return ret;
1428 }
1429
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (153080 bytes)
Powered by blists - more mailing lists