Re: [PATCH net-next 1/2] fs/crashdd: add API to collect hardware dump in second kernel
From: kbuild test robot
Date: Sat Mar 24 2018 - 08:30:08 EST
Hi Rahul,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Rahul-Lakkireddy/fs-crashdd-add-API-to-collect-hardware-dump-in-second-kernel/20180324-193856
config: i386-randconfig-s0-201811 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
In file included from fs/crashdd/crashdd.c:8:0:
fs/crashdd/crashdd_internal.h:13:23: error: field 'bin_attr' has incomplete type
struct bin_attribute bin_attr; /* Binary dump file's attributes */
^~~~~~~~
fs/crashdd/crashdd.c: In function 'crashdd_read':
fs/crashdd/crashdd.c:20:43: error: dereferencing pointer to incomplete type 'struct bin_attribute'
struct crashdd_dump_node *dump = bin_attr->private;
^~
fs/crashdd/crashdd.c: In function 'crashdd_mkdir':
>> fs/crashdd/crashdd.c:28:9: error: implicit declaration of function 'kobject_create_and_add' [-Werror=implicit-function-declaration]
return kobject_create_and_add(name, crashdd_kobj);
^~~~~~~~~~~~~~~~~~~~~~
fs/crashdd/crashdd.c:28:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
return kobject_create_and_add(name, crashdd_kobj);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/crashdd/crashdd.c: In function 'crashdd_add_file':
fs/crashdd/crashdd.c:40:9: error: implicit declaration of function 'sysfs_create_bin_file' [-Werror=implicit-function-declaration]
return sysfs_create_bin_file(kobj, &dump->bin_attr);
^~~~~~~~~~~~~~~~~~~~~
fs/crashdd/crashdd.c: In function 'crashdd_rmdir':
>> fs/crashdd/crashdd.c:45:2: error: implicit declaration of function 'kobject_put' [-Werror=implicit-function-declaration]
kobject_put(kobj);
^~~~~~~~~~~
fs/crashdd/crashdd.c: In function 'crashdd_get_driver':
fs/crashdd/crashdd.c:102:25: error: dereferencing pointer to incomplete type 'struct kobject'
if (!strcmp(node->kobj->name, name)) {
^~
fs/crashdd/crashdd.c: In function 'crashdd_init':
>> fs/crashdd/crashdd.c:228:51: error: 'kernel_kobj' undeclared (first use in this function)
crashdd_kobj = kobject_create_and_add("crashdd", kernel_kobj);
^~~~~~~~~~~
fs/crashdd/crashdd.c:228:51: note: each undeclared identifier is reported only once for each function it appears in
fs/crashdd/crashdd.c: In function 'crashdd_add_file':
fs/crashdd/crashdd.c:41:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
cc1: some warnings being treated as errors
vim +/kobject_create_and_add +28 fs/crashdd/crashdd.c
7
> 8 #include "crashdd_internal.h"
9
10 static LIST_HEAD(crashdd_list);
11 static DEFINE_MUTEX(crashdd_mutex);
12
13 #define CRASHDD_SYSFS_MODE 444 /* S_IRUGO */
14 static struct kobject *crashdd_kobj;
15
16 static ssize_t crashdd_read(struct file *filp, struct kobject *kobj,
17 struct bin_attribute *bin_attr,
18 char *buf, loff_t fpos, size_t count)
19 {
20 struct crashdd_dump_node *dump = bin_attr->private;
21
22 memcpy(buf, dump->buf + fpos, count);
23 return count;
24 }
25
26 static struct kobject *crashdd_mkdir(const char *name)
27 {
> 28 return kobject_create_and_add(name, crashdd_kobj);
29 }
30
31 static int crashdd_add_file(struct kobject *kobj, const char *name,
32 struct crashdd_dump_node *dump)
33 {
34 dump->bin_attr.attr.name = name;
35 dump->bin_attr.attr.mode = CRASHDD_SYSFS_MODE;
36 dump->bin_attr.size = dump->size;
37 dump->bin_attr.read = crashdd_read;
38 dump->bin_attr.private = dump;
39
40 return sysfs_create_bin_file(kobj, &dump->bin_attr);
41 }
42
43 static void crashdd_rmdir(struct kobject *kobj)
44 {
> 45 kobject_put(kobj);
46 }
47
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip