drivers/net/ethernet/marvell/octeontx2/af/cgx.c:622 cgx_lmac_enadis_rx_pause_fwding() error: uninitialized symbol 'rx_pause'.

From: Dan Carpenter
Date: Mon May 23 2022 - 09:17:14 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eaea45fc0e7b6ae439526b4a41d91230c8517336
commit: e740003874edc13e468d19233f99787bedb4bb8e octeontx2-af: Flow control resource management
config: s390-randconfig-m031-20220522 (https://download.01.org/0day-ci/archive/20220522/202205222253.Mj6ywHyJ-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/net/ethernet/marvell/octeontx2/af/cgx.c:622 cgx_lmac_enadis_rx_pause_fwding() error: uninitialized symbol 'rx_pause'.

vim +/rx_pause +622 drivers/net/ethernet/marvell/octeontx2/af/cgx.c

5d9b976d4480dc Sunil Goutham 2019-11-14 602 void cgx_lmac_enadis_rx_pause_fwding(void *cgxd, int lmac_id, bool enable)
5d9b976d4480dc Sunil Goutham 2019-11-14 603 {
5d9b976d4480dc Sunil Goutham 2019-11-14 604 struct cgx *cgx = cgxd;
e740003874edc1 Hariprasad Kelam 2022-02-09 605 u8 rx_pause, tx_pause;
e740003874edc1 Hariprasad Kelam 2022-02-09 606 bool is_pfc_enabled;
e740003874edc1 Hariprasad Kelam 2022-02-09 607 struct lmac *lmac;
5d9b976d4480dc Sunil Goutham 2019-11-14 608 u64 cfg;
5d9b976d4480dc Sunil Goutham 2019-11-14 609
5d9b976d4480dc Sunil Goutham 2019-11-14 610 if (!cgx)
5d9b976d4480dc Sunil Goutham 2019-11-14 611 return;
5d9b976d4480dc Sunil Goutham 2019-11-14 612
e740003874edc1 Hariprasad Kelam 2022-02-09 613 lmac = lmac_pdata(lmac_id, cgx);
e740003874edc1 Hariprasad Kelam 2022-02-09 614 if (!lmac)
e740003874edc1 Hariprasad Kelam 2022-02-09 615 return;
e740003874edc1 Hariprasad Kelam 2022-02-09 616
e740003874edc1 Hariprasad Kelam 2022-02-09 617 /* Pause frames are not enabled just return */
e740003874edc1 Hariprasad Kelam 2022-02-09 618 if (!bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max))
e740003874edc1 Hariprasad Kelam 2022-02-09 619 return;
e740003874edc1 Hariprasad Kelam 2022-02-09 620
e740003874edc1 Hariprasad Kelam 2022-02-09 621 cgx_lmac_get_pause_frm_status(cgx, lmac_id, &rx_pause, &tx_pause);

The first two returns in cgx_lmac_get_pause_frm_status() don't initialize
rx or tx pause.

e740003874edc1 Hariprasad Kelam 2022-02-09 @622 is_pfc_enabled = rx_pause ? false : true;
^^^^^^^^

e740003874edc1 Hariprasad Kelam 2022-02-09 623
5d9b976d4480dc Sunil Goutham 2019-11-14 624 if (enable) {
e740003874edc1 Hariprasad Kelam 2022-02-09 625 if (!is_pfc_enabled) {
5d9b976d4480dc Sunil Goutham 2019-11-14 626 cfg = cgx_read(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL);
5d9b976d4480dc Sunil Goutham 2019-11-14 627 cfg |= CGX_GMP_GMI_RXX_FRM_CTL_CTL_BCK;
5d9b976d4480dc Sunil Goutham 2019-11-14 628 cgx_write(cgx, lmac_id, CGXX_GMP_GMI_RXX_FRM_CTL, cfg);
5d9b976d4480dc Sunil Goutham 2019-11-14 629
5d9b976d4480dc Sunil Goutham 2019-11-14 630 cfg = cgx_read(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL);
5d9b976d4480dc Sunil Goutham 2019-11-14 631 cfg |= CGX_SMUX_RX_FRM_CTL_CTL_BCK;

--
0-DAY CI Kernel Test Service
https://01.org/lkp