CC: [email protected]
BCC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: Colin Foster <[email protected]>
CC: Vladimir Oltean <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   71941773e143369a73c9c4a3b62fbb60736a1182
commit: d87b1c08f38a2ce40cf559df36c107a2e6c16a8f [5133/11953] net: mscc: 
ocelot: use bulk reads for stats
:::::: branch date: 3 days ago
:::::: commit date: 4 weeks ago
config: riscv-randconfig-m031-20220313 
(https://download.01.org/0day-ci/archive/20220313/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/net/ethernet/mscc/ocelot.c:1778 ocelot_port_update_stats() error: 
uninitialized symbol 'err'.
drivers/net/ethernet/mscc/ocelot.c:1796 ocelot_check_stats_work() error: 
uninitialized symbol 'err'.

vim +/err +1778 drivers/net/ethernet/mscc/ocelot.c

a556c76adc052c Alexandre Belloni 2018-05-14  1747  
7fbf6795d127a3 Colin Foster      2022-02-10  1748  /* Caller must hold 
&ocelot->stats_lock */
d87b1c08f38a2c Colin Foster      2022-02-13  1749  static int 
ocelot_port_update_stats(struct ocelot *ocelot, int port)
a556c76adc052c Alexandre Belloni 2018-05-14  1750  {
d87b1c08f38a2c Colin Foster      2022-02-13  1751       unsigned int idx = port 
* ocelot->num_stats;
d87b1c08f38a2c Colin Foster      2022-02-13  1752       struct 
ocelot_stats_region *region;
d87b1c08f38a2c Colin Foster      2022-02-13  1753       int err, j;
a556c76adc052c Alexandre Belloni 2018-05-14  1754  
a556c76adc052c Alexandre Belloni 2018-05-14  1755       /* Configure the port 
to read the stats from */
e27d785e60b6b1 Colin Foster      2022-02-13  1756       ocelot_write(ocelot, 
SYS_STAT_CFG_STAT_VIEW(port), SYS_STAT_CFG);
a556c76adc052c Alexandre Belloni 2018-05-14  1757  
d87b1c08f38a2c Colin Foster      2022-02-13  1758       
list_for_each_entry(region, &ocelot->stats_regions, node) {
d87b1c08f38a2c Colin Foster      2022-02-13  1759               err = 
ocelot_bulk_read_rix(ocelot, SYS_COUNT_RX_OCTETS,
d87b1c08f38a2c Colin Foster      2022-02-13  1760                               
           region->offset, region->buf,
d87b1c08f38a2c Colin Foster      2022-02-13  1761                               
           region->count);
d87b1c08f38a2c Colin Foster      2022-02-13  1762               if (err)
d87b1c08f38a2c Colin Foster      2022-02-13  1763                       return 
err;
a556c76adc052c Alexandre Belloni 2018-05-14  1764  
d87b1c08f38a2c Colin Foster      2022-02-13  1765               for (j = 0; j < 
region->count; j++) {
d87b1c08f38a2c Colin Foster      2022-02-13  1766                       u64 
*stat = &ocelot->stats[idx + j];
d87b1c08f38a2c Colin Foster      2022-02-13  1767                       u64 val 
= region->buf[j];
a556c76adc052c Alexandre Belloni 2018-05-14  1768  
d87b1c08f38a2c Colin Foster      2022-02-13  1769                       if (val 
< (*stat & U32_MAX))
d87b1c08f38a2c Colin Foster      2022-02-13  1770                               
*stat += (u64)1 << 32;
d87b1c08f38a2c Colin Foster      2022-02-13  1771  
d87b1c08f38a2c Colin Foster      2022-02-13  1772                       *stat = 
(*stat & ~(u64)U32_MAX) + val;
d87b1c08f38a2c Colin Foster      2022-02-13  1773               }
a556c76adc052c Alexandre Belloni 2018-05-14  1774  
d87b1c08f38a2c Colin Foster      2022-02-13  1775               idx += 
region->count;
a556c76adc052c Alexandre Belloni 2018-05-14  1776       }
d87b1c08f38a2c Colin Foster      2022-02-13  1777  
d87b1c08f38a2c Colin Foster      2022-02-13 @1778       return err;
1e1caa9735f90b Claudiu Manoil    2019-04-16  1779  }
1e1caa9735f90b Claudiu Manoil    2019-04-16  1780  
1e1caa9735f90b Claudiu Manoil    2019-04-16  1781  static void 
ocelot_check_stats_work(struct work_struct *work)
1e1caa9735f90b Claudiu Manoil    2019-04-16  1782  {
1e1caa9735f90b Claudiu Manoil    2019-04-16  1783       struct delayed_work 
*del_work = to_delayed_work(work);
1e1caa9735f90b Claudiu Manoil    2019-04-16  1784       struct ocelot *ocelot = 
container_of(del_work, struct ocelot,
1e1caa9735f90b Claudiu Manoil    2019-04-16  1785                               
             stats_work);
d87b1c08f38a2c Colin Foster      2022-02-13  1786       int i, err;
1e1caa9735f90b Claudiu Manoil    2019-04-16  1787  
7fbf6795d127a3 Colin Foster      2022-02-10  1788       
mutex_lock(&ocelot->stats_lock);
d87b1c08f38a2c Colin Foster      2022-02-13  1789       for (i = 0; i < 
ocelot->num_phys_ports; i++) {
d87b1c08f38a2c Colin Foster      2022-02-13  1790               err = 
ocelot_port_update_stats(ocelot, i);
d87b1c08f38a2c Colin Foster      2022-02-13  1791               if (err)
d87b1c08f38a2c Colin Foster      2022-02-13  1792                       break;
d87b1c08f38a2c Colin Foster      2022-02-13  1793       }
7fbf6795d127a3 Colin Foster      2022-02-10  1794       
mutex_unlock(&ocelot->stats_lock);
1e1caa9735f90b Claudiu Manoil    2019-04-16  1795  
d87b1c08f38a2c Colin Foster      2022-02-13 @1796       if (err)
d87b1c08f38a2c Colin Foster      2022-02-13  1797               
dev_err(ocelot->dev, "Error %d updating ethtool stats\n",  err);
d87b1c08f38a2c Colin Foster      2022-02-13  1798  
a556c76adc052c Alexandre Belloni 2018-05-14  1799       
queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work,
a556c76adc052c Alexandre Belloni 2018-05-14  1800                          
OCELOT_STATS_CHECK_DELAY);
a556c76adc052c Alexandre Belloni 2018-05-14  1801  }
a556c76adc052c Alexandre Belloni 2018-05-14  1802  

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/[email protected]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to