public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc
@ 2026-02-15 12:29 Samyak
  2026-02-16  2:50 ` kernel test robot
  2026-02-16  8:14 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Samyak @ 2026-02-15 12:29 UTC (permalink / raw)
  To: marvin24
  Cc: gregkh, ac100, linux-tegra, linux-staging, linux-kernel,
	Samyak Bambole

From: Samyak Bambole <samyak.bambole07@gmail.com>

Replace kzalloc(sizeof(*ptr), GFP_KERNEL) with kzalloc_obj(*ptr,
GFP_KERNEL)

This addresses the following scripts/checkpatch.ph warning:
  WARNING: Prefer kzalloc_obj over kzalloc with sizeof

Signed-off-by: Samyak Bambole <samyak.bambole07@gmail.com>
---
 drivers/staging/nvec/nvec_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index 2db57795ea2f..3422a5213803 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -102,7 +102,7 @@ static int nvec_mouse_probe(struct platform_device *pdev)
 	struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
 	struct serio *ser_dev;
 
-	ser_dev = kzalloc(sizeof(*ser_dev), GFP_KERNEL);
+	ser_dev = kzalloc_obj(*ser_dev, GFP_KERNEL);
 	if (!ser_dev)
 		return -ENOMEM;
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc
  2026-02-15 12:29 [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc Samyak
@ 2026-02-16  2:50 ` kernel test robot
  2026-02-16  8:14 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-02-16  2:50 UTC (permalink / raw)
  To: Samyak, marvin24
  Cc: llvm, oe-kbuild-all, gregkh, ac100, linux-tegra, linux-staging,
	linux-kernel, Samyak Bambole

Hi Samyak,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Samyak/staging-nvec-Use-kzalloc_obj-instead-of-kzalloc/20260215-203130
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20260215122913.104064-1-samyak.bambole07%40gmail.com
patch subject: [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc
config: arm-defconfig (https://download.01.org/0day-ci/archive/20260216/202602161056.Elbb21hV-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project afd4df07ab0262482829d4410a6bae9f2809d37b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260216/202602161056.Elbb21hV-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602161056.Elbb21hV-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/staging/nvec/nvec_ps2.c:105:12: error: call to undeclared function 'kzalloc_obj'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     105 |         ser_dev = kzalloc_obj(*ser_dev, GFP_KERNEL);
         |                   ^
>> drivers/staging/nvec/nvec_ps2.c:105:10: error: incompatible integer to pointer conversion assigning to 'struct serio *' from 'int' [-Wint-conversion]
     105 |         ser_dev = kzalloc_obj(*ser_dev, GFP_KERNEL);
         |                 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   2 errors generated.


vim +/kzalloc_obj +105 drivers/staging/nvec/nvec_ps2.c

    99	
   100	static int nvec_mouse_probe(struct platform_device *pdev)
   101	{
   102		struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
   103		struct serio *ser_dev;
   104	
 > 105		ser_dev = kzalloc_obj(*ser_dev, GFP_KERNEL);
   106		if (!ser_dev)
   107			return -ENOMEM;
   108	
   109		ser_dev->id.type = SERIO_8042;
   110		ser_dev->write = ps2_sendcommand;
   111		ser_dev->start = ps2_startstreaming;
   112		ser_dev->stop = ps2_stopstreaming;
   113	
   114		strscpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name));
   115		strscpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys));
   116	
   117		ps2_dev.ser_dev = ser_dev;
   118		ps2_dev.notifier.notifier_call = nvec_ps2_notifier;
   119		ps2_dev.nvec = nvec;
   120		nvec_register_notifier(nvec, &ps2_dev.notifier, 0);
   121	
   122		serio_register_port(ser_dev);
   123	
   124		return 0;
   125	}
   126	

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc
  2026-02-15 12:29 [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc Samyak
  2026-02-16  2:50 ` kernel test robot
@ 2026-02-16  8:14 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-02-16  8:14 UTC (permalink / raw)
  To: Samyak, marvin24
  Cc: oe-kbuild-all, gregkh, ac100, linux-tegra, linux-staging,
	linux-kernel, Samyak Bambole

Hi Samyak,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Samyak/staging-nvec-Use-kzalloc_obj-instead-of-kzalloc/20260215-203130
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20260215122913.104064-1-samyak.bambole07%40gmail.com
patch subject: [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20260216/202602161613.Rka1Yb9E-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260216/202602161613.Rka1Yb9E-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602161613.Rka1Yb9E-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/staging/nvec/nvec_ps2.c: In function 'nvec_mouse_probe':
>> drivers/staging/nvec/nvec_ps2.c:105:19: error: implicit declaration of function 'kzalloc_obj'; did you mean 'kzalloc_node'? [-Wimplicit-function-declaration]
     105 |         ser_dev = kzalloc_obj(*ser_dev, GFP_KERNEL);
         |                   ^~~~~~~~~~~
         |                   kzalloc_node
>> drivers/staging/nvec/nvec_ps2.c:105:17: error: assignment to 'struct serio *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     105 |         ser_dev = kzalloc_obj(*ser_dev, GFP_KERNEL);
         |                 ^


vim +105 drivers/staging/nvec/nvec_ps2.c

    99	
   100	static int nvec_mouse_probe(struct platform_device *pdev)
   101	{
   102		struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
   103		struct serio *ser_dev;
   104	
 > 105		ser_dev = kzalloc_obj(*ser_dev, GFP_KERNEL);
   106		if (!ser_dev)
   107			return -ENOMEM;
   108	
   109		ser_dev->id.type = SERIO_8042;
   110		ser_dev->write = ps2_sendcommand;
   111		ser_dev->start = ps2_startstreaming;
   112		ser_dev->stop = ps2_stopstreaming;
   113	
   114		strscpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name));
   115		strscpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys));
   116	
   117		ps2_dev.ser_dev = ser_dev;
   118		ps2_dev.notifier.notifier_call = nvec_ps2_notifier;
   119		ps2_dev.nvec = nvec;
   120		nvec_register_notifier(nvec, &ps2_dev.notifier, 0);
   121	
   122		serio_register_port(ser_dev);
   123	
   124		return 0;
   125	}
   126	

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-16  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 12:29 [PATCH] staging: nvec: Use kzalloc_obj instead of kzalloc Samyak
2026-02-16  2:50 ` kernel test robot
2026-02-16  8:14 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox