staging: nvec: Use kzalloc_obj instead of kzalloc
Subsystems (3)
PATCH 1/1 staging: nvec: Use kzalloc_obj instead of kzalloc
From: Samyak Bambole <[email protected]>
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
--- drivers/staging/nvec/nvec_ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/nvec/nvec_ps2.c +1 -1
@@ -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 ;
Signature · 1 line
2.53.0
kernel test robot
build botkernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki