mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[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>
This commit is contained in:
parent
cf85d5ca88
commit
1ac19f4ccd
1 changed files with 19 additions and 4 deletions
|
@ -192,22 +192,37 @@ static int hdpu_cpustate_probe(struct device *ddev)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(ddev);
|
struct platform_device *pdev = to_platform_device(ddev);
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
struct proc_dir_entry *proc_de;
|
||||||
|
int ret;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
cpustate.set_addr = (unsigned long *)res->start;
|
cpustate.set_addr = (unsigned long *)res->start;
|
||||||
cpustate.clr_addr = (unsigned long *)res->end - 1;
|
cpustate.clr_addr = (unsigned long *)res->end - 1;
|
||||||
|
|
||||||
misc_register(&cpustate_dev);
|
ret = misc_register(&cpustate_dev);
|
||||||
create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
|
if (ret) {
|
||||||
|
printk(KERN_WARNING "sky_cpustate: Unable to register misc "
|
||||||
|
"device.\n");
|
||||||
|
cpustate.set_addr = NULL;
|
||||||
|
cpustate.clr_addr = NULL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
proc_de = create_proc_read_entry("sky_cpustate", 0, 0,
|
||||||
|
cpustate_read_proc, NULL);
|
||||||
|
if (proc_de == NULL)
|
||||||
|
printk(KERN_WARNING "sky_cpustate: Unable to create proc "
|
||||||
|
"dir entry\n");
|
||||||
|
|
||||||
printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
|
printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hdpu_cpustate_remove(struct device *ddev)
|
static int hdpu_cpustate_remove(struct device *ddev)
|
||||||
{
|
{
|
||||||
|
|
||||||
cpustate.set_addr = 0;
|
cpustate.set_addr = NULL;
|
||||||
cpustate.clr_addr = 0;
|
cpustate.clr_addr = NULL;
|
||||||
|
|
||||||
remove_proc_entry("sky_cpustate", NULL);
|
remove_proc_entry("sky_cpustate", NULL);
|
||||||
misc_deregister(&cpustate_dev);
|
misc_deregister(&cpustate_dev);
|
||||||
|
|
Loading…
Reference in a new issue