drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c:1783 cgx_print_stats() warn: inconsistent indenting

From: kernel test robot
Date: Fri Jul 23 2021 - 06:10:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8baef6386baaefb776bdd09b5c7630cf057c51c6
commit: ce7a6c3106de5724c45d555ed84acdd3930e8e71 octeontx2-af: cn10k: Add RPM Rx/Tx stats support
date: 5 months ago
config: mips-randconfig-m031-20210723 (attached as .config)
compiler: mips64-linux-gcc (GCC) 10.3.0

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

New smatch warnings:
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c:1783 cgx_print_stats() warn: inconsistent indenting

Old smatch warnings:
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c:480 rvu_dbg_qsize_write() warn: potentially one past the end of array 'cmd_buf[count]'
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c:480 rvu_dbg_qsize_write() warn: potentially one past the end of array 'cmd_buf[count]'

vim +1783 drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c

1668
1669 #define PRINT_CGX_CUML_NIXRX_STATUS(idx, name) \
1670 ({ \
1671 u64 cnt; \
1672 err = rvu_cgx_nix_cuml_stats(rvu, cgxd, lmac_id, (idx), \
1673 NIX_STATS_RX, &(cnt)); \
1674 if (!err) \
1675 seq_printf(s, "%s: %llu\n", name, cnt); \
1676 cnt; \
1677 })
1678
1679 #define PRINT_CGX_CUML_NIXTX_STATUS(idx, name) \
1680 ({ \
1681 u64 cnt; \
1682 err = rvu_cgx_nix_cuml_stats(rvu, cgxd, lmac_id, (idx), \
1683 NIX_STATS_TX, &(cnt)); \
1684 if (!err) \
1685 seq_printf(s, "%s: %llu\n", name, cnt); \
1686 cnt; \
1687 })
1688
1689 static int cgx_print_stats(struct seq_file *s, int lmac_id)
1690 {
1691 struct cgx_link_user_info linfo;
1692 struct mac_ops *mac_ops;
1693 void *cgxd = s->private;
1694 u64 ucast, mcast, bcast;
1695 int stat = 0, err = 0;
1696 u64 tx_stat, rx_stat;
1697 struct rvu *rvu;
1698
1699 rvu = pci_get_drvdata(pci_get_device(PCI_VENDOR_ID_CAVIUM,
1700 PCI_DEVID_OCTEONTX2_RVU_AF, NULL));
1701 if (!rvu)
1702 return -ENODEV;
1703
1704 mac_ops = get_mac_ops(cgxd);
1705
1706 if (!mac_ops)
1707 return 0;
1708
1709 /* Link status */
1710 seq_puts(s, "\n=======Link Status======\n\n");
1711 err = cgx_get_link_info(cgxd, lmac_id, &linfo);
1712 if (err)
1713 seq_puts(s, "Failed to read link status\n");
1714 seq_printf(s, "\nLink is %s %d Mbps\n\n",
1715 linfo.link_up ? "UP" : "DOWN", linfo.speed);
1716
1717 /* Rx stats */
1718 seq_printf(s, "\n=======NIX RX_STATS(%s port level)======\n\n",
1719 mac_ops->name);
1720 ucast = PRINT_CGX_CUML_NIXRX_STATUS(RX_UCAST, "rx_ucast_frames");
1721 if (err)
1722 return err;
1723 mcast = PRINT_CGX_CUML_NIXRX_STATUS(RX_MCAST, "rx_mcast_frames");
1724 if (err)
1725 return err;
1726 bcast = PRINT_CGX_CUML_NIXRX_STATUS(RX_BCAST, "rx_bcast_frames");
1727 if (err)
1728 return err;
1729 seq_printf(s, "rx_frames: %llu\n", ucast + mcast + bcast);
1730 PRINT_CGX_CUML_NIXRX_STATUS(RX_OCTS, "rx_bytes");
1731 if (err)
1732 return err;
1733 PRINT_CGX_CUML_NIXRX_STATUS(RX_DROP, "rx_drops");
1734 if (err)
1735 return err;
1736 PRINT_CGX_CUML_NIXRX_STATUS(RX_ERR, "rx_errors");
1737 if (err)
1738 return err;
1739
1740 /* Tx stats */
1741 seq_printf(s, "\n=======NIX TX_STATS(%s port level)======\n\n",
1742 mac_ops->name);
1743 ucast = PRINT_CGX_CUML_NIXTX_STATUS(TX_UCAST, "tx_ucast_frames");
1744 if (err)
1745 return err;
1746 mcast = PRINT_CGX_CUML_NIXTX_STATUS(TX_MCAST, "tx_mcast_frames");
1747 if (err)
1748 return err;
1749 bcast = PRINT_CGX_CUML_NIXTX_STATUS(TX_BCAST, "tx_bcast_frames");
1750 if (err)
1751 return err;
1752 seq_printf(s, "tx_frames: %llu\n", ucast + mcast + bcast);
1753 PRINT_CGX_CUML_NIXTX_STATUS(TX_OCTS, "tx_bytes");
1754 if (err)
1755 return err;
1756 PRINT_CGX_CUML_NIXTX_STATUS(TX_DROP, "tx_drops");
1757 if (err)
1758 return err;
1759
1760 /* Rx stats */
1761 seq_printf(s, "\n=======%s RX_STATS======\n\n", mac_ops->name);
1762 while (stat < mac_ops->rx_stats_cnt) {
1763 err = mac_ops->mac_get_rx_stats(cgxd, lmac_id, stat, &rx_stat);
1764 if (err)
1765 return err;
1766 if (is_rvu_otx2(rvu))
1767 seq_printf(s, "%s: %llu\n", cgx_rx_stats_fields[stat],
1768 rx_stat);
1769 else
1770 seq_printf(s, "%s: %llu\n", rpm_rx_stats_fields[stat],
1771 rx_stat);
1772 stat++;
1773 }
1774
1775 /* Tx stats */
1776 stat = 0;
1777 seq_printf(s, "\n=======%s TX_STATS======\n\n", mac_ops->name);
1778 while (stat < mac_ops->tx_stats_cnt) {
1779 err = mac_ops->mac_get_tx_stats(cgxd, lmac_id, stat, &tx_stat);
1780 if (err)
1781 return err;
1782
> 1783 if (is_rvu_otx2(rvu))
1784 seq_printf(s, "%s: %llu\n", cgx_tx_stats_fields[stat],
1785 tx_stat);
1786 else
1787 seq_printf(s, "%s: %llu\n", rpm_tx_stats_fields[stat],
1788 tx_stat);
1789 stat++;
1790 }
1791
1792 return err;
1793 }
1794

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

Attachment: .config.gz
Description: application/gzip