* [jpirko-mlxsw:linecards 2/93] drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1467:4: warning: variable 'mlxsw_sp_port' is uninitialized when used here
@ 2021-04-30 13:46 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-04-30 13:46 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 18038 bytes --]
tree: https://github.com/jpirko/linux_mlxsw linecards
head: 3d0591edf41e844589c788fe97e0f5b9a658d2e4
commit: b63e73885a85434a3bcfbead69cd1ef43dc3754d [2/93] mlxsw: spectrum: Move port SWID set before core port init
config: x86_64-randconfig-a012-20210430 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/jpirko/linux_mlxsw/commit/b63e73885a85434a3bcfbead69cd1ef43dc3754d
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw linecards
git checkout b63e73885a85434a3bcfbead69cd1ef43dc3754d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1467:4: warning: variable 'mlxsw_sp_port' is uninitialized when used here [-Wuninitialized]
mlxsw_sp_port->local_port);
^~~~~~~~~~~~~
include/linux/dev_printk.h:112:32: note: expanded from macro 'dev_err'
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1451:37: note: initialize the variable 'mlxsw_sp_port' to silence this warning
struct mlxsw_sp_port *mlxsw_sp_port;
^
= NULL
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:110:1: warning: unused function 'mlxsw_tx_hdr_version_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, version, 0x00, 28, 4);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:70:1: note: expanded from here
mlxsw_tx_hdr_version_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:117:1: warning: unused function 'mlxsw_tx_hdr_ctl_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, ctl, 0x00, 26, 2);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:103:1: note: expanded from here
mlxsw_tx_hdr_ctl_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:122:1: warning: unused function 'mlxsw_tx_hdr_proto_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, proto, 0x00, 21, 3);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:136:1: note: expanded from here
mlxsw_tx_hdr_proto_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:127:1: warning: unused function 'mlxsw_tx_hdr_rx_is_router_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, rx_is_router, 0x00, 19, 1);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:169:1: note: expanded from here
mlxsw_tx_hdr_rx_is_router_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:127:1: warning: unused function 'mlxsw_tx_hdr_rx_is_router_set' [-Wunused-function]
drivers/net/ethernet/mellanox/mlxsw/item.h:359:20: note: expanded from macro 'MLXSW_ITEM32'
static inline void mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u32 val)\
^
<scratch space>:181:1: note: expanded from here
mlxsw_tx_hdr_rx_is_router_set
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:133:1: warning: unused function 'mlxsw_tx_hdr_fid_valid_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, fid_valid, 0x00, 16, 1);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:202:1: note: expanded from here
mlxsw_tx_hdr_fid_valid_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:133:1: warning: unused function 'mlxsw_tx_hdr_fid_valid_set' [-Wunused-function]
drivers/net/ethernet/mellanox/mlxsw/item.h:359:20: note: expanded from macro 'MLXSW_ITEM32'
static inline void mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u32 val)\
^
<scratch space>:214:1: note: expanded from here
mlxsw_tx_hdr_fid_valid_set
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:138:1: warning: unused function 'mlxsw_tx_hdr_swid_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, swid, 0x00, 12, 3);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:235:1: note: expanded from here
mlxsw_tx_hdr_swid_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:144:1: warning: unused function 'mlxsw_tx_hdr_control_tclass_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, control_tclass, 0x00, 6, 1);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:29:1: note: expanded from here
mlxsw_tx_hdr_control_tclass_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:149:1: warning: unused function 'mlxsw_tx_hdr_etclass_get' [-Wunused-function]
MLXSW_ITEM32(tx, hdr, etclass, 0x00, 0, 4);
^
drivers/net/ethernet/mellanox/mlxsw/item.h:355:19: note: expanded from macro 'MLXSW_ITEM32'
static inline u32 mlxsw_##_type##_##_cname##_##_iname##_get(const char *buf) \
^
<scratch space>:62:1: note: expanded from here
mlxsw_tx_hdr_etclass_get
^
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:149:1: warning: unused function 'mlxsw_tx_hdr_etclass_set' [-Wunused-function]
drivers/net/ethernet/mellanox/mlxsw/item.h:359:20: note: expanded from macro 'MLXSW_ITEM32'
static inline void mlxsw_##_type##_##_cname##_##_iname##_set(char *buf, u32 val)\
^
<scratch space>:74:1: note: expanded from here
vim +/mlxsw_sp_port +1467 drivers/net/ethernet/mellanox/mlxsw/spectrum.c
1444
1445 static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
1446 u8 split_base_local_port,
1447 struct mlxsw_sp_port_mapping *port_mapping)
1448 {
1449 struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
1450 bool split = !!split_base_local_port;
1451 struct mlxsw_sp_port *mlxsw_sp_port;
1452 u32 lanes = port_mapping->width;
1453 struct net_device *dev;
1454 bool splittable;
1455 int err;
1456
1457 err = mlxsw_sp_port_module_map(mlxsw_sp, local_port, port_mapping);
1458 if (err) {
1459 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to map module\n",
1460 local_port);
1461 return err;
1462 }
1463
1464 err = mlxsw_sp_port_swid_set(mlxsw_sp, local_port, 0);
1465 if (err) {
1466 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n",
> 1467 mlxsw_sp_port->local_port);
1468 goto err_port_swid_set;
1469 }
1470
1471 splittable = lanes > 1 && !split;
1472 err = mlxsw_core_port_init(mlxsw_sp->core, local_port,
1473 port_mapping->module + 1, split,
1474 port_mapping->lane / lanes,
1475 splittable, lanes,
1476 mlxsw_sp->base_mac,
1477 sizeof(mlxsw_sp->base_mac));
1478 if (err) {
1479 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to init core port\n",
1480 local_port);
1481 goto err_core_port_init;
1482 }
1483
1484 dev = alloc_etherdev(sizeof(struct mlxsw_sp_port));
1485 if (!dev) {
1486 err = -ENOMEM;
1487 goto err_alloc_etherdev;
1488 }
1489 SET_NETDEV_DEV(dev, mlxsw_sp->bus_info->dev);
1490 dev_net_set(dev, mlxsw_sp_net(mlxsw_sp));
1491 mlxsw_sp_port = netdev_priv(dev);
1492 mlxsw_sp_port->dev = dev;
1493 mlxsw_sp_port->mlxsw_sp = mlxsw_sp;
1494 mlxsw_sp_port->local_port = local_port;
1495 mlxsw_sp_port->pvid = MLXSW_SP_DEFAULT_VID;
1496 mlxsw_sp_port->split = split;
1497 mlxsw_sp_port->split_base_local_port = split_base_local_port;
1498 mlxsw_sp_port->mapping = *port_mapping;
1499 mlxsw_sp_port->link.autoneg = 1;
1500 INIT_LIST_HEAD(&mlxsw_sp_port->vlans_list);
1501
1502 mlxsw_sp_port->pcpu_stats =
1503 netdev_alloc_pcpu_stats(struct mlxsw_sp_port_pcpu_stats);
1504 if (!mlxsw_sp_port->pcpu_stats) {
1505 err = -ENOMEM;
1506 goto err_alloc_stats;
1507 }
1508
1509 INIT_DELAYED_WORK(&mlxsw_sp_port->periodic_hw_stats.update_dw,
1510 &update_stats_cache);
1511
1512 dev->netdev_ops = &mlxsw_sp_port_netdev_ops;
1513 dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops;
1514
1515 err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port);
1516 if (err) {
1517 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n",
1518 mlxsw_sp_port->local_port);
1519 goto err_dev_addr_init;
1520 }
1521
1522 netif_carrier_off(dev);
1523
1524 dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_LLTX | NETIF_F_SG |
1525 NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
1526 dev->hw_features |= NETIF_F_HW_TC | NETIF_F_LOOPBACK;
1527
1528 dev->min_mtu = 0;
1529 dev->max_mtu = ETH_MAX_MTU;
1530
1531 /* Each packet needs to have a Tx header (metadata) on top all other
1532 * headers.
1533 */
1534 dev->needed_headroom = MLXSW_TXHDR_LEN;
1535
1536 err = mlxsw_sp_port_system_port_mapping_set(mlxsw_sp_port);
1537 if (err) {
1538 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set system port mapping\n",
1539 mlxsw_sp_port->local_port);
1540 goto err_port_system_port_mapping_set;
1541 }
1542
1543 err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port);
1544 if (err) {
1545 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n",
1546 mlxsw_sp_port->local_port);
1547 goto err_port_speed_by_width_set;
1548 }
1549
1550 err = mlxsw_sp->port_type_speed_ops->ptys_max_speed(mlxsw_sp_port,
1551 &mlxsw_sp_port->max_speed);
1552 if (err) {
1553 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to get maximum speed\n",
1554 mlxsw_sp_port->local_port);
1555 goto err_max_speed_get;
1556 }
1557
1558 err = mlxsw_sp_port_max_mtu_get(mlxsw_sp_port, &mlxsw_sp_port->max_mtu);
1559 if (err) {
1560 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to get maximum MTU\n",
1561 mlxsw_sp_port->local_port);
1562 goto err_port_max_mtu_get;
1563 }
1564
1565 err = mlxsw_sp_port_mtu_set(mlxsw_sp_port, ETH_DATA_LEN);
1566 if (err) {
1567 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set MTU\n",
1568 mlxsw_sp_port->local_port);
1569 goto err_port_mtu_set;
1570 }
1571
1572 err = mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false);
1573 if (err)
1574 goto err_port_admin_status_set;
1575
1576 err = mlxsw_sp_port_buffers_init(mlxsw_sp_port);
1577 if (err) {
1578 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize buffers\n",
1579 mlxsw_sp_port->local_port);
1580 goto err_port_buffers_init;
1581 }
1582
1583 err = mlxsw_sp_port_ets_init(mlxsw_sp_port);
1584 if (err) {
1585 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize ETS\n",
1586 mlxsw_sp_port->local_port);
1587 goto err_port_ets_init;
1588 }
1589
1590 err = mlxsw_sp_port_tc_mc_mode_set(mlxsw_sp_port, true);
1591 if (err) {
1592 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize TC MC mode\n",
1593 mlxsw_sp_port->local_port);
1594 goto err_port_tc_mc_mode;
1595 }
1596
1597 /* ETS and buffers must be initialized before DCB. */
1598 err = mlxsw_sp_port_dcb_init(mlxsw_sp_port);
1599 if (err) {
1600 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize DCB\n",
1601 mlxsw_sp_port->local_port);
1602 goto err_port_dcb_init;
1603 }
1604
1605 err = mlxsw_sp_port_fids_init(mlxsw_sp_port);
1606 if (err) {
1607 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize FIDs\n",
1608 mlxsw_sp_port->local_port);
1609 goto err_port_fids_init;
1610 }
1611
1612 err = mlxsw_sp_tc_qdisc_init(mlxsw_sp_port);
1613 if (err) {
1614 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize TC qdiscs\n",
1615 mlxsw_sp_port->local_port);
1616 goto err_port_qdiscs_init;
1617 }
1618
1619 err = mlxsw_sp_port_vlan_set(mlxsw_sp_port, 0, VLAN_N_VID - 1, false,
1620 false);
1621 if (err) {
1622 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to clear VLAN filter\n",
1623 mlxsw_sp_port->local_port);
1624 goto err_port_vlan_clear;
1625 }
1626
1627 err = mlxsw_sp_port_nve_init(mlxsw_sp_port);
1628 if (err) {
1629 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to initialize NVE\n",
1630 mlxsw_sp_port->local_port);
1631 goto err_port_nve_init;
1632 }
1633
1634 err = mlxsw_sp_port_pvid_set(mlxsw_sp_port, MLXSW_SP_DEFAULT_VID,
1635 ETH_P_8021Q);
1636 if (err) {
1637 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set PVID\n",
1638 mlxsw_sp_port->local_port);
1639 goto err_port_pvid_set;
1640 }
1641
1642 mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_create(mlxsw_sp_port,
1643 MLXSW_SP_DEFAULT_VID);
1644 if (IS_ERR(mlxsw_sp_port_vlan)) {
1645 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to create VID 1\n",
1646 mlxsw_sp_port->local_port);
1647 err = PTR_ERR(mlxsw_sp_port_vlan);
1648 goto err_port_vlan_create;
1649 }
1650 mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan;
1651
1652 /* Set SPVC.et0=true and SPVC.et1=false to make the local port to treat
1653 * only packets with 802.1q header as tagged packets.
1654 */
1655 err = mlxsw_sp_port_vlan_classification_set(mlxsw_sp_port, false, true);
1656 if (err) {
1657 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set default VLAN classification\n",
1658 local_port);
1659 goto err_port_vlan_classification_set;
1660 }
1661
1662 INIT_DELAYED_WORK(&mlxsw_sp_port->ptp.shaper_dw,
1663 mlxsw_sp->ptp_ops->shaper_work);
1664
1665 mlxsw_sp->ports[local_port] = mlxsw_sp_port;
1666
1667 err = mlxsw_sp_port_overheat_init_val_set(mlxsw_sp_port);
1668 if (err) {
1669 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set overheat initial value\n",
1670 mlxsw_sp_port->local_port);
1671 goto err_port_overheat_init_val_set;
1672 }
1673
1674 err = register_netdev(dev);
1675 if (err) {
1676 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to register netdev\n",
1677 mlxsw_sp_port->local_port);
1678 goto err_register_netdev;
1679 }
1680
1681 mlxsw_core_port_eth_set(mlxsw_sp->core, mlxsw_sp_port->local_port,
1682 mlxsw_sp_port, dev);
1683 mlxsw_core_schedule_dw(&mlxsw_sp_port->periodic_hw_stats.update_dw, 0);
1684 return 0;
1685
1686 err_register_netdev:
1687 err_port_overheat_init_val_set:
1688 mlxsw_sp_port_vlan_classification_set(mlxsw_sp_port, true, true);
1689 err_port_vlan_classification_set:
1690 mlxsw_sp->ports[local_port] = NULL;
1691 mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
1692 err_port_vlan_create:
1693 err_port_pvid_set:
1694 mlxsw_sp_port_nve_fini(mlxsw_sp_port);
1695 err_port_nve_init:
1696 err_port_vlan_clear:
1697 mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
1698 err_port_qdiscs_init:
1699 mlxsw_sp_port_fids_fini(mlxsw_sp_port);
1700 err_port_fids_init:
1701 mlxsw_sp_port_dcb_fini(mlxsw_sp_port);
1702 err_port_dcb_init:
1703 mlxsw_sp_port_tc_mc_mode_set(mlxsw_sp_port, false);
1704 err_port_tc_mc_mode:
1705 err_port_ets_init:
1706 mlxsw_sp_port_buffers_fini(mlxsw_sp_port);
1707 err_port_buffers_init:
1708 err_port_admin_status_set:
1709 err_port_mtu_set:
1710 err_port_max_mtu_get:
1711 err_max_speed_get:
1712 err_port_speed_by_width_set:
1713 err_port_system_port_mapping_set:
1714 err_dev_addr_init:
1715 free_percpu(mlxsw_sp_port->pcpu_stats);
1716 err_alloc_stats:
1717 free_netdev(dev);
1718 err_alloc_etherdev:
1719 mlxsw_core_port_fini(mlxsw_sp->core, local_port);
1720 err_core_port_init:
1721 mlxsw_sp_port_swid_set(mlxsw_sp, local_port,
1722 MLXSW_PORT_SWID_DISABLED_PORT);
1723 err_port_swid_set:
1724 mlxsw_sp_port_module_unmap(mlxsw_sp, local_port);
1725 return err;
1726 }
1727
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40615 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-30 13:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-30 13:46 [jpirko-mlxsw:linecards 2/93] drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1467:4: warning: variable 'mlxsw_sp_port' is uninitialized when used here kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.