From: kernel test robot <lkp@intel.com>
To: kernel@openeuler.org, fanyizhen1995 <en_0015767@163.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [openeuler:OLK-5.10 24518/30000] drivers/ub/urma/uburma/uburma_dev_ops.c:32:6: warning: no previous prototype for 'uburma_release_file'
Date: Sun, 24 Mar 2024 22:29:37 +0800 [thread overview]
Message-ID: <202403242235.dk8Ti59s-lkp@intel.com> (raw)
Hi Yizhen,
FYI, the error/warning still remains.
tree: https://gitee.com/openeuler/kernel.git OLK-5.10
head: b670dd901cbbf97745380d373b1d2607b3235590
commit: cd637a6dded9c0dce5f8d79898bb25be2edb927a [24518/30000] ub: uburma support open/release file ops
config: arm64-randconfig-003-20240312 (https://download.01.org/0day-ci/archive/20240324/202403242235.dk8Ti59s-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240324/202403242235.dk8Ti59s-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/202403242235.dk8Ti59s-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/ub/urma/uburma/uburma_dev_ops.c:32:6: warning: no previous prototype for 'uburma_release_file' [-Wmissing-prototypes]
32 | void uburma_release_file(struct kref *ref)
| ^~~~~~~~~~~~~~~~~~~
>> drivers/ub/urma/uburma/uburma_dev_ops.c:49:5: warning: no previous prototype for 'uburma_open' [-Wmissing-prototypes]
49 | int uburma_open(struct inode *inode, struct file *filp)
| ^~~~~~~~~~~
drivers/ub/urma/uburma/uburma_dev_ops.c: In function 'uburma_open':
>> drivers/ub/urma/uburma/uburma_dev_ops.c:66:50: warning: the comparison will always evaluate as 'false' for the address of 'dev_name' will never be NULL [-Waddress]
66 | if (ubc_dev == NULL || ubc_dev->dev_name == NULL) {
| ^~
In file included from drivers/ub/urma/uburma/uburma_dev_ops.c:25:
include/urma/ubcore_types.h:1589:14: note: 'dev_name' declared here
1589 | char dev_name[UBCORE_MAX_DEV_NAME];
| ^~~~~~~~
drivers/ub/urma/uburma/uburma_dev_ops.c: At top level:
>> drivers/ub/urma/uburma/uburma_dev_ops.c:102:5: warning: no previous prototype for 'uburma_close' [-Wmissing-prototypes]
102 | int uburma_close(struct inode *inode, struct file *filp)
| ^~~~~~~~~~~~
vim +/uburma_release_file +32 drivers/ub/urma/uburma/uburma_dev_ops.c
31
> 32 void uburma_release_file(struct kref *ref)
33 {
34 struct uburma_file *file = container_of(ref, struct uburma_file, ref);
35 int srcu_idx;
36
37 srcu_idx = srcu_read_lock(&file->ubu_dev->ubc_dev_srcu);
38 srcu_dereference(file->ubu_dev->ubc_dev, &file->ubu_dev->ubc_dev_srcu);
39
40 srcu_read_unlock(&file->ubu_dev->ubc_dev_srcu, srcu_idx);
41
42 if (atomic_dec_and_test(&file->ubu_dev->refcnt))
43 complete(&file->ubu_dev->comp);
44
45 kobject_put(&file->ubu_dev->kobj);
46 kfree(file);
47 }
48
> 49 int uburma_open(struct inode *inode, struct file *filp)
50 {
51 struct uburma_device *ubu_dev;
52 struct ubcore_device *ubc_dev;
53 struct uburma_file *file;
54 int srcu_idx;
55 int ret;
56
57 ubu_dev = container_of(inode->i_cdev, struct uburma_device, cdev);
58 if (!atomic_inc_not_zero(&ubu_dev->refcnt)) {
59 uburma_log_err("device was not ready.\n");
60 return -ENXIO;
61 }
62
63 srcu_idx = srcu_read_lock(&ubu_dev->ubc_dev_srcu);
64 mutex_lock(&ubu_dev->lists_mutex);
65 ubc_dev = srcu_dereference(ubu_dev->ubc_dev, &ubu_dev->ubc_dev_srcu);
> 66 if (ubc_dev == NULL || ubc_dev->dev_name == NULL) {
67 uburma_log_err("can not find ubcore device.\n");
68 ret = EIO;
69 goto err;
70 }
71
72 file = kzalloc(sizeof(struct uburma_file), GFP_KERNEL);
73 if (!file) {
74 ret = -ENOMEM;
75 uburma_log_err("can not alloc memory.\n");
76 goto err;
77 }
78
79 file->ubu_dev = ubu_dev;
80 file->ucontext = NULL;
81 kref_init(&file->ref);
82 mutex_init(&file->mutex);
83 filp->private_data = file;
84
85 list_add_tail(&file->list, &ubu_dev->uburma_file_list);
86 kobject_get(&ubu_dev->kobj); // Increase reference count for file.
87
88 mutex_unlock(&ubu_dev->lists_mutex);
89 srcu_read_unlock(&ubu_dev->ubc_dev_srcu, srcu_idx);
90
91 uburma_log_info("device: %s open succeed.\n", ubc_dev->dev_name);
92 return nonseekable_open(inode, filp);
93
94 err:
95 mutex_unlock(&ubu_dev->lists_mutex);
96 srcu_read_unlock(&ubu_dev->ubc_dev_srcu, srcu_idx);
97 if (atomic_dec_and_test(&ubu_dev->refcnt))
98 complete(&ubu_dev->comp);
99 return ret;
100 }
101
> 102 int uburma_close(struct inode *inode, struct file *filp)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-03-24 14:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202403242235.dk8Ti59s-lkp@intel.com \
--to=lkp@intel.com \
--cc=en_0015767@163.com \
--cc=kernel@openeuler.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.