summaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-04-01 04:50:16 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 20:13:34 +0200
commit6ea1511ec4ed477aeb5846275b52c89204d47089 (patch)
tree4925c4a00bc013370fd771176c6b341cc4cef61f /arch/ia64
parentsrm_env: don't bother with pointer to srm_env_t (diff)
downloadlinux-6ea1511ec4ed477aeb5846275b52c89204d47089.tar.xz
linux-6ea1511ec4ed477aeb5846275b52c89204d47089.zip
prominfo_proc fixes
* check for proc_mkdir() failures * use remove_proc_subtree() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/sn/kernel/sn2/prominfo_proc.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
index 20b88cb1881a..90298bda936a 100644
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
@@ -216,58 +216,40 @@ void __exit prominfo_exit(void);
module_init(prominfo_init);
module_exit(prominfo_exit);
-static struct proc_dir_entry **proc_entries;
static struct proc_dir_entry *sgi_prominfo_entry;
#define NODE_NAME_LEN 11
int __init prominfo_init(void)
{
- struct proc_dir_entry **entp;
cnodeid_t cnodeid;
- unsigned long nasid;
- int size;
- char name[NODE_NAME_LEN];
if (!ia64_platform_is("sn2"))
return 0;
- size = num_online_nodes() * sizeof(struct proc_dir_entry *);
- proc_entries = kzalloc(size, GFP_KERNEL);
- if (!proc_entries)
- return -ENOMEM;
-
sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL);
+ if (!sgi_prominfo_entry)
+ return -ENOMEM;
- entp = proc_entries;
for_each_online_node(cnodeid) {
+ struct proc_dir_entry *dir;
+ unsigned long nasid;
+ char name[NODE_NAME_LEN];
+
sprintf(name, "node%d", cnodeid);
- *entp = proc_mkdir(name, sgi_prominfo_entry);
+ dir = proc_mkdir(name, sgi_prominfo_entry);
+ if (!dir)
+ continue;
nasid = cnodeid_to_nasid(cnodeid);
- create_proc_read_entry("fit", 0, *entp, read_fit_entry,
+ create_proc_read_entry("fit", 0, dir, read_fit_entry,
(void *)nasid);
- create_proc_read_entry("version", 0, *entp,
+ create_proc_read_entry("version", 0, dir,
read_version_entry, (void *)nasid);
- entp++;
}
-
return 0;
}
void __exit prominfo_exit(void)
{
- struct proc_dir_entry **entp;
- unsigned int cnodeid;
- char name[NODE_NAME_LEN];
-
- entp = proc_entries;
- for_each_online_node(cnodeid) {
- remove_proc_entry("fit", *entp);
- remove_proc_entry("version", *entp);
- sprintf(name, "node%d", cnodeid);
- remove_proc_entry(name, sgi_prominfo_entry);
- entp++;
- }
- remove_proc_entry("sgi_prominfo", NULL);
- kfree(proc_entries);
+ remove_proc_subtree("sgi_prominfo", NULL);
}