Re: [PATCH 5/5] net: ethernet: altera: rename functions and their prototypes

From: Dan Carpenter
Date: Wed Jan 03 2024 - 06:23:36 EST


Hi,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/deepakx-nagaraju-intel-com/net-ethernet-altera-remove-unneeded-assignments/20231213-151600
base: net/main
patch link: https://lore.kernel.org/r/20231213071112.18242-6-deepakx.nagaraju%40intel.com
patch subject: [PATCH 5/5] net: ethernet: altera: rename functions and their prototypes
config: m68k-randconfig-r081-20231218 (https://download.01.org/0day-ci/archive/20231220/202312200739.79WGCuyb-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202312200739.79WGCuyb-lkp@xxxxxxxxx/

New smatch warnings:
drivers/net/ethernet/altera/altera_tse_main.c:266 alloc_init_skbufs() warn: double check that we're allocating correct size: 24 vs 164

Old smatch warnings:
drivers/net/ethernet/altera/altera_tse_main.c:271 alloc_init_skbufs() warn: double check that we're allocating correct size: 24 vs 164
drivers/net/ethernet/altera/altera_tse_main.c:988 tse_open() warn: 'priv->tx_irq' from request_irq() not released on lines: 988.

vim +266 drivers/net/ethernet/altera/altera_tse_main.c

bbd2190ce96d8f Vince Bridgers 2014-03-17 257 static int alloc_init_skbufs(struct altera_tse_private *priv)
bbd2190ce96d8f Vince Bridgers 2014-03-17 258 {
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 259 struct altera_dma_private *dma = &priv->dma_priv;
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 260 unsigned int rx_descs = dma->rx_ring_size;
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 261 unsigned int tx_descs = dma->tx_ring_size;
bbd2190ce96d8f Vince Bridgers 2014-03-17 262 int ret = -ENOMEM;
bbd2190ce96d8f Vince Bridgers 2014-03-17 263 int i;
bbd2190ce96d8f Vince Bridgers 2014-03-17 264
bbd2190ce96d8f Vince Bridgers 2014-03-17 265 /* Create Rx ring buffer */
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 @266 dma->rx_ring = kcalloc(rx_descs, sizeof(struct altera_dma_private), GFP_KERNEL);

There is a mismatch here. dma->rx_ring was changed to altera_dma_buffer
but the sizeof was changed to altera_dma_private.

ad6f888f174e6a Nagaraju DeepakX 2023-12-13 267 if (!dma->rx_ring)
bbd2190ce96d8f Vince Bridgers 2014-03-17 268 goto err_rx_ring;
bbd2190ce96d8f Vince Bridgers 2014-03-17 269
bbd2190ce96d8f Vince Bridgers 2014-03-17 270 /* Create Tx ring buffer */
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 271 dma->tx_ring = kcalloc(tx_descs, sizeof(struct altera_dma_private), GFP_KERNEL);
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 272 if (!dma->tx_ring)
bbd2190ce96d8f Vince Bridgers 2014-03-17 273 goto err_tx_ring;
bbd2190ce96d8f Vince Bridgers 2014-03-17 274
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 275 dma->tx_cons = 0;
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 276 dma->tx_prod = 0;
bbd2190ce96d8f Vince Bridgers 2014-03-17 277
bbd2190ce96d8f Vince Bridgers 2014-03-17 278 /* Init Rx ring */
bbd2190ce96d8f Vince Bridgers 2014-03-17 279 for (i = 0; i < rx_descs; i++) {
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 280 ret = tse_init_rx_buffer(priv, &priv->dma_priv.rx_ring[i], dma->rx_dma_buf_sz);
bbd2190ce96d8f Vince Bridgers 2014-03-17 281 if (ret)
bbd2190ce96d8f Vince Bridgers 2014-03-17 282 goto err_init_rx_buffers;
bbd2190ce96d8f Vince Bridgers 2014-03-17 283 }
bbd2190ce96d8f Vince Bridgers 2014-03-17 284
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 285 dma->rx_cons = 0;
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 286 dma->rx_prod = 0;
bbd2190ce96d8f Vince Bridgers 2014-03-17 287
bbd2190ce96d8f Vince Bridgers 2014-03-17 288 return 0;
bbd2190ce96d8f Vince Bridgers 2014-03-17 289 err_init_rx_buffers:
bbd2190ce96d8f Vince Bridgers 2014-03-17 290 while (--i >= 0)
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 291 tse_free_rx_buffer(priv, &priv->dma_priv.rx_ring[i]);
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 292 kfree(dma->tx_ring);
bbd2190ce96d8f Vince Bridgers 2014-03-17 293 err_tx_ring:
ad6f888f174e6a Nagaraju DeepakX 2023-12-13 294 kfree(dma->rx_ring);
bbd2190ce96d8f Vince Bridgers 2014-03-17 295 err_rx_ring:
bbd2190ce96d8f Vince Bridgers 2014-03-17 296 return ret;
bbd2190ce96d8f Vince Bridgers 2014-03-17 297 }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki