drivers/accel/amdxdna/amdxdna_mailbox.c:203:9: error: implicit declaration of function 'kfree'

From: kernel test robot
Date: Sat Feb 15 2025 - 13:30:30 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6452feaf29a6a1cc1c904520c4b1b4cd90133fac
commit: b87f920b934426a24d54613f12ed67c03ae05024 accel/amdxdna: Support hardware mailbox
date: 3 months ago
config: x86_64-buildonly-randconfig-002-20250216 (https://download.01.org/0day-ci/archive/20250216/202502160209.WZSMNh1N-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250216/202502160209.WZSMNh1N-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/202502160209.WZSMNh1N-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_release_msg':
>> drivers/accel/amdxdna/amdxdna_mailbox.c:203:9: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
203 | kfree(mb_msg);
| ^~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c: At top level:
drivers/accel/amdxdna/amdxdna_mailbox.c:357:8: error: unknown type name 'irqreturn_t'
357 | static irqreturn_t mailbox_irq_handler(int irq, void *p)
| ^~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_irq_handler':
drivers/accel/amdxdna/amdxdna_mailbox.c:367:16: error: 'IRQ_HANDLED' undeclared (first use in this function)
367 | return IRQ_HANDLED;
| ^~~~~~~~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c:367:16: note: each undeclared identifier is reported only once for each function it appears in
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_rx_worker':
drivers/accel/amdxdna/amdxdna_mailbox.c:395:25: error: implicit declaration of function 'disable_irq'; did you mean 'disable_work'? [-Werror=implicit-function-declaration]
395 | disable_irq(mb_chann->msix_irq);
| ^~~~~~~~~~~
| disable_work
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'xdna_mailbox_send_msg':
>> drivers/accel/amdxdna/amdxdna_mailbox.c:431:18: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
431 | mb_msg = kzalloc(sizeof(*mb_msg) + pkg_size, GFP_KERNEL);
| ^~~~~~~
>> drivers/accel/amdxdna/amdxdna_mailbox.c:431:16: warning: assignment to 'struct mailbox_msg *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
431 | mb_msg = kzalloc(sizeof(*mb_msg) + pkg_size, GFP_KERNEL);
| ^
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'xdna_mailbox_create_channel':
>> drivers/accel/amdxdna/amdxdna_mailbox.c:490:18: warning: assignment to 'struct mailbox_channel *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
490 | mb_chann = kzalloc(sizeof(*mb_chann), GFP_KERNEL);
| ^
drivers/accel/amdxdna/amdxdna_mailbox.c:513:15: error: implicit declaration of function 'request_irq'; did you mean 'request_region'? [-Werror=implicit-function-declaration]
513 | ret = request_irq(mb_irq, mailbox_irq_handler, 0, MAILBOX_NAME, mb_chann);
| ^~~~~~~~~~~
| request_region
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'xdna_mailbox_destroy_channel':
drivers/accel/amdxdna/amdxdna_mailbox.c:537:9: error: implicit declaration of function 'free_irq' [-Werror=implicit-function-declaration]
537 | free_irq(mb_chann->msix_irq, mb_chann);
| ^~~~~~~~
drivers/accel/amdxdna/amdxdna_mailbox.c: In function 'mailbox_irq_handler':
drivers/accel/amdxdna/amdxdna_mailbox.c:368:1: warning: control reaches end of non-void function [-Wreturn-type]
368 | }
| ^
cc1: some warnings being treated as errors


vim +/kfree +203 drivers/accel/amdxdna/amdxdna_mailbox.c

194
195 static int mailbox_release_msg(int id, void *p, void *data)
196 {
197 struct mailbox_channel *mb_chann = data;
198 struct mailbox_msg *mb_msg = p;
199
200 MB_DBG(mb_chann, "msg_id 0x%x msg opcode 0x%x",
201 mb_msg->pkg.header.id, mb_msg->pkg.header.opcode);
202 mb_msg->notify_cb(mb_msg->handle, NULL, 0);
> 203 kfree(mb_msg);
204
205 return 0;
206 }
207

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