Re: [PATCH] hsi: hsi_core: use kzalloc_flex
From: kernel test robot
Date: Tue Mar 17 2026 - 09:54:44 EST
Hi Rosen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on sre-hsi/for-next]
[also build test WARNING on kees/for-next/kspp next-20260316]
[cannot apply to kees/for-next/pstore linus/master v6.16-rc1]
[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/Rosen-Penev/hsi-hsi_core-use-kzalloc_flex/20260316-091623
base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git for-next
patch link: https://lore.kernel.org/r/20260316004139.267912-1-rosenp%40gmail.com
patch subject: [PATCH] hsi: hsi_core: use kzalloc_flex
config: i386-randconfig-2006-20250804 (https://download.01.org/0day-ci/archive/20260317/202603171431.ThUSplSw-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260317/202603171431.ThUSplSw-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/202603171431.ThUSplSw-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
drivers/hsi/hsi_core.c: In function 'hsi_put_controller':
>> drivers/hsi/hsi_core.c:447:21: warning: the comparison will always evaluate as 'true' for the address of 'port' will never be NULL [-Waddress]
447 | if (hsi->port && hsi->port[i])
| ^~~
In file included from drivers/hsi/hsi_core.c:9:
include/linux/hsi/hsi.h:274:34: note: 'port' declared here
274 | struct hsi_port *port[] __counted_by(num_ports);
| ^~~~
vim +447 drivers/hsi/hsi_core.c
a056ab8c7a00a0f drivers/hsi/hsi.c Carlos Chinea 2010-04-16 429
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 430 /**
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 431 * hsi_put_controller - Free an HSI controller
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 432 *
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 433 * @hsi: Pointer to the HSI controller to freed
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 434 *
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 435 * HSI controller drivers should only use this function if they need
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 436 * to free their allocated hsi_controller structures before a successful
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 437 * call to hsi_register_controller. Other use is not allowed.
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 438 */
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 439 void hsi_put_controller(struct hsi_controller *hsi)
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 440 {
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 441 unsigned int i;
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 442
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 443 if (!hsi)
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 444 return;
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 445
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 446 for (i = 0; i < hsi->num_ports; i++)
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 @447 if (hsi->port && hsi->port[i])
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 448 put_device(&hsi->port[i]->device);
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 449 put_device(&hsi->device);
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 450 }
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 451 EXPORT_SYMBOL_GPL(hsi_put_controller);
5a218ceba7b64f5 drivers/hsi/hsi.c Carlos Chinea 2012-04-04 452
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki