Subject: [vhost:vhost 32/44] drivers/remoteproc/remoteproc_sysfs.c:55:2: error: implicit declaration of function 'kfree'; did you mean 'vfree'?

From: kbuild test robot <[email-masked]>
Date: Tue, 7 Apr 2020 08:27:06 +0800

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost
head:   4e6ebec0de18aaea5f5f814b25bfcae3751c6369
commit: 013a472de94693ba05696d59e7df3224c20a22e6 [32/44] virtio: stop using legacy struct vring in kernel
config: x86_64-randconfig-s1-20200407 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
        git checkout 013a472de94693ba05696d59e7df3224c20a22e6
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email-masked]>

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

   drivers/remoteproc/remoteproc_sysfs.c: In function 'firmware_store':
>> drivers/remoteproc/remoteproc_sysfs.c:55:2: error: implicit declaration of function 'kfree'; did you mean 'vfree'? [-Werror=implicit-function-declaration]
     kfree(rproc->firmware);
     ^~~~~
     vfree
   cc1: some warnings being treated as errors
--
   drivers/char/hw_random/virtio-rng.c: In function 'probe_common':
>> drivers/char/hw_random/virtio-rng.c:92:7: error: implicit declaration of function 'kzalloc'; did you mean 'vzalloc'? [-Werror=implicit-function-declaration]
     vi = kzalloc(sizeof(struct virtrng_info), GFP_KERNEL);
          ^~~~~~~
          vzalloc
>> drivers/char/hw_random/virtio-rng.c:92:5: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     vi = kzalloc(sizeof(struct virtrng_info), GFP_KERNEL);
        ^
>> drivers/char/hw_random/virtio-rng.c:125:2: error: implicit declaration of function 'kfree'; did you mean 'vfree'? [-Werror=implicit-function-declaration]
     kfree(vi);
     ^~~~~
     vfree
   cc1: some warnings being treated as errors

vim +55 drivers/remoteproc/remoteproc_sysfs.c

2aefbef0414981 Matt Redfearn 2016-10-19  20  
2aefbef0414981 Matt Redfearn 2016-10-19  21  /* Change firmware name via sysfs */
2aefbef0414981 Matt Redfearn 2016-10-19  22  static ssize_t firmware_store(struct device *dev,
2aefbef0414981 Matt Redfearn 2016-10-19  23  			      struct device_attribute *attr,
2aefbef0414981 Matt Redfearn 2016-10-19  24  			      const char *buf, size_t count)
2aefbef0414981 Matt Redfearn 2016-10-19  25  {
2aefbef0414981 Matt Redfearn 2016-10-19  26  	struct rproc *rproc = to_rproc(dev);
2aefbef0414981 Matt Redfearn 2016-10-19  27  	char *p;
2aefbef0414981 Matt Redfearn 2016-10-19  28  	int err, len = count;
2aefbef0414981 Matt Redfearn 2016-10-19  29  
2aefbef0414981 Matt Redfearn 2016-10-19  30  	err = mutex_lock_interruptible(&rproc->lock);
2aefbef0414981 Matt Redfearn 2016-10-19  31  	if (err) {
2aefbef0414981 Matt Redfearn 2016-10-19  32  		dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, err);
2aefbef0414981 Matt Redfearn 2016-10-19  33  		return -EINVAL;
2aefbef0414981 Matt Redfearn 2016-10-19  34  	}
2aefbef0414981 Matt Redfearn 2016-10-19  35  
2aefbef0414981 Matt Redfearn 2016-10-19  36  	if (rproc->state != RPROC_OFFLINE) {
2aefbef0414981 Matt Redfearn 2016-10-19  37  		dev_err(dev, "can't change firmware while running\n");
2aefbef0414981 Matt Redfearn 2016-10-19  38  		err = -EBUSY;
2aefbef0414981 Matt Redfearn 2016-10-19  39  		goto out;
2aefbef0414981 Matt Redfearn 2016-10-19  40  	}
2aefbef0414981 Matt Redfearn 2016-10-19  41  
2aefbef0414981 Matt Redfearn 2016-10-19  42  	len = strcspn(buf, "\n");
faeadbb6409475 Suman Anna    2018-09-14  43  	if (!len) {
faeadbb6409475 Suman Anna    2018-09-14  44  		dev_err(dev, "can't provide a NULL firmware\n");
faeadbb6409475 Suman Anna    2018-09-14  45  		err = -EINVAL;
faeadbb6409475 Suman Anna    2018-09-14  46  		goto out;
faeadbb6409475 Suman Anna    2018-09-14  47  	}
2aefbef0414981 Matt Redfearn 2016-10-19  48  
2aefbef0414981 Matt Redfearn 2016-10-19  49  	p = kstrndup(buf, len, GFP_KERNEL);
2aefbef0414981 Matt Redfearn 2016-10-19  50  	if (!p) {
2aefbef0414981 Matt Redfearn 2016-10-19  51  		err = -ENOMEM;
2aefbef0414981 Matt Redfearn 2016-10-19  52  		goto out;
2aefbef0414981 Matt Redfearn 2016-10-19  53  	}
2aefbef0414981 Matt Redfearn 2016-10-19  54  
2aefbef0414981 Matt Redfearn 2016-10-19 @55  	kfree(rproc->firmware);
2aefbef0414981 Matt Redfearn 2016-10-19  56  	rproc->firmware = p;
2aefbef0414981 Matt Redfearn 2016-10-19  57  out:
2aefbef0414981 Matt Redfearn 2016-10-19  58  	mutex_unlock(&rproc->lock);
2aefbef0414981 Matt Redfearn 2016-10-19  59  
2aefbef0414981 Matt Redfearn 2016-10-19  60  	return err ? err : count;
2aefbef0414981 Matt Redfearn 2016-10-19  61  }
2aefbef0414981 Matt Redfearn 2016-10-19  62  static DEVICE_ATTR_RW(firmware);
2aefbef0414981 Matt Redfearn 2016-10-19  63  

:::::: The code at line 55 was first introduced by commit
:::::: 2aefbef041498182ce1d186ed2300298b7a7101a remoteproc: Add a sysfs interface for firmware and state

:::::: TO: Matt Redfearn <[email-masked]>
:::::: CC: Bjorn Andersson <[email-masked]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]