Re: [PATCH] gpib: tnt4882: fix memory leak on probe failure

From: kernel test robot

Date: Sun Sep 13 2026 - 18:19:16 EST


Hi Guangshuo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kees/for-next/kspp]
[also build test WARNING on linus/master kees/for-next/pstore v7.3-rc2 next-20260911]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Guangshuo-Li/gpib-tnt4882-fix-memory-leak-on-probe-failure/20260913-143603
base: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/kspp
patch link: https://lore.kernel.org/r/20260913063603.1443403-1-lgs201920130244%40gmail.com
patch subject: [PATCH] gpib: tnt4882: fix memory leak on probe failure
config: x86_64-randconfig-r133-20260914 (https://download.01.org/0day-ci/archive/20260914/202609140612.F8ICypXs-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260914/202609140612.F8ICypXs-lkp@xxxxxxxxx/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609140612.F8ICypXs-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/gpib/tnt4882/tnt4882_gpib.c: In function 'ni_gpib_probe':
drivers/gpib/tnt4882/tnt4882_gpib.c:1588:9: error: 'ret' undeclared (first use in this function); did you mean 'net'?
1588 | ret = ni_gpib_config(link);
| ^~~
| net
drivers/gpib/tnt4882/tnt4882_gpib.c:1588:9: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpib/tnt4882/tnt4882_gpib.c:1595:1: warning: control reaches end of non-void function [-Wreturn-type]
1595 | }
| ^


vim +1595 drivers/gpib/tnt4882/tnt4882_gpib.c

0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1557
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1558 /*
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1559 * ni_gpib_probe() creates an "instance" of the driver, allocating
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1560 * local data structures for one device. The device is registered
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1561 * with Card Services.
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1562 */
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1563
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1564 static int ni_gpib_probe(struct pcmcia_device *link)
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1565 {
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1566 struct local_info_t *info;
fc2c620c3924f26 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Michael Rubin 2025-03-19 1567 //struct struct gpib_board *dev;
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1568
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1569 /* Allocate space for private device-specific data */
bf4afc53b77aeaa drivers/gpib/tnt4882/tnt4882_gpib.c Linus Torvalds 2026-02-21 1570 info = kzalloc_obj(*info);
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1571 if (!info)
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1572 return -ENOMEM;
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1573
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1574 info->p_dev = link;
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1575 link->priv = info;
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1576
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1577 /*
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1578 * General socket configuration defaults can go here. In this
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1579 * client, we assume very little, and rely on the CIS for almost
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1580 * everything. In most clients, many details (i.e., number, sizes,
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1581 * and attributes of IO windows) are fixed by the nature of the
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1582 * device, and can be hard-wired here.
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1583 */
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1584 link->config_flags = CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1585
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1586 /* Register with Card Services */
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1587 curr_dev = link;
4d0c779a70d29c2 drivers/gpib/tnt4882/tnt4882_gpib.c Guangshuo Li 2026-09-13 1588 ret = ni_gpib_config(link);
4d0c779a70d29c2 drivers/gpib/tnt4882/tnt4882_gpib.c Guangshuo Li 2026-09-13 1589 if (ret) {
4d0c779a70d29c2 drivers/gpib/tnt4882/tnt4882_gpib.c Guangshuo Li 2026-09-13 1590 kfree(info);
4d0c779a70d29c2 drivers/gpib/tnt4882/tnt4882_gpib.c Guangshuo Li 2026-09-13 1591 link->priv = NULL;
4d0c779a70d29c2 drivers/gpib/tnt4882/tnt4882_gpib.c Guangshuo Li 2026-09-13 1592 }
4d0c779a70d29c2 drivers/gpib/tnt4882/tnt4882_gpib.c Guangshuo Li 2026-09-13 1593
4d0c779a70d29c2 drivers/gpib/tnt4882/tnt4882_gpib.c Guangshuo Li 2026-09-13 1594 return ret;
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 @1595 }
0cd5b05551e0224 drivers/staging/gpib/tnt4882/tnt4882_gpib.c Dave Penkler 2024-09-18 1596

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