aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/hdpuftrs/hdpu_cpustate.c
diff options
context:
space:
mode:
authorChristophe Lucas <clucas@rotomalug.org>2005-09-10 03:26:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-10 13:06:25 -0400
commit1ac19f4ccd8636dbe76a97cec36c95d7548cc871 (patch)
tree1faa1f44183628138643a9e5eb011b2c4d3f6484 /drivers/misc/hdpuftrs/hdpu_cpustate.c
parentcf85d5ca880c9611906e0ca0c729fdf01c724501 (diff)
[PATCH] hdpu_cpustate.c: misc_register() can fail
Signed-off-by: Christophe Lucas <clucas@rotomalug.org> Signed-off-by: Domen Puncer <domen@coderock.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/misc/hdpuftrs/hdpu_cpustate.c')
-rw-r--r--drivers/misc/hdpuftrs/hdpu_cpustate.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c
index 7501fab349e4..46de5c940555 100644
--- a/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -192,22 +192,37 @@ static int hdpu_cpustate_probe(struct device *ddev)
192{ 192{
193 struct platform_device *pdev = to_platform_device(ddev); 193 struct platform_device *pdev = to_platform_device(ddev);
194 struct resource *res; 194 struct resource *res;
195 struct proc_dir_entry *proc_de;
196 int ret;
195 197
196 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 198 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
197 cpustate.set_addr = (unsigned long *)res->start; 199 cpustate.set_addr = (unsigned long *)res->start;
198 cpustate.clr_addr = (unsigned long *)res->end - 1; 200 cpustate.clr_addr = (unsigned long *)res->end - 1;
199 201
200 misc_register(&cpustate_dev); 202 ret = misc_register(&cpustate_dev);
201 create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL); 203 if (ret) {
204 printk(KERN_WARNING "sky_cpustate: Unable to register misc "
205 "device.\n");
206 cpustate.set_addr = NULL;
207 cpustate.clr_addr = NULL;
208 return ret;
209 }
210
211 proc_de = create_proc_read_entry("sky_cpustate", 0, 0,
212 cpustate_read_proc, NULL);
213 if (proc_de == NULL)
214 printk(KERN_WARNING "sky_cpustate: Unable to create proc "
215 "dir entry\n");
202 216
203 printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n"); 217 printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
204 return 0; 218 return 0;
205} 219}
220
206static int hdpu_cpustate_remove(struct device *ddev) 221static int hdpu_cpustate_remove(struct device *ddev)
207{ 222{
208 223
209 cpustate.set_addr = 0; 224 cpustate.set_addr = NULL;
210 cpustate.clr_addr = 0; 225 cpustate.clr_addr = NULL;
211 226
212 remove_proc_entry("sky_cpustate", NULL); 227 remove_proc_entry("sky_cpustate", NULL);
213 misc_deregister(&cpustate_dev); 228 misc_deregister(&cpustate_dev);