Skip to contentSkip to conversation

Audit return code :

PATCH RESEND Superseded Christophe Lucas 2 participants 7 messages Jun 22, 2005 – Jun 23, 2005

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 Audit return code :

description:
Audit return codes (and handle failure correctly) for misc_register.

drivers/misc/hdpuftrs/hdpu_cpustate.c +16 -4
diff -urpNX dontdiff 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -192,13 +192,25 @@ static int hdpu_cpustate_probe(struct de
 {
 	struct platform_device *pdev = to_platform_device(ddev);
 	struct resource *res;
+	struct proc_dir_entry *proc_de;
+	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	cpustate.set_addr = (unsigned long *)res->start;
 	cpustate.clr_addr = (unsigned long *)res->end - 1;
 
-	misc_register(&cpustate_dev);
-	create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
+	ret = misc_register(&cpustate_dev);
+	if (ret) {
+		printk(KERN_WARNING "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 "Unable to create proc dir entry for hdpu_cpustate device.\n");
+	}
 
 	printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
 	return 0;
@@ -206,8 +218,8 @@ static int hdpu_cpustate_probe(struct de
 static int hdpu_cpustate_remove(struct device *ddev)
 {
 
-	cpustate.set_addr = 0;
-	cpustate.clr_addr = 0;
+	cpustate.set_addr = NULL;
+	cpustate.clr_addr = NULL;
 
 	remove_proc_entry("sky_cpustate", NULL);
 	misc_deregister(&cpustate_dev);

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

On Wed, 22 Jun 2005 10:00:00 +0200 Christophe Lucas wrote:

| diff -urpNX dontdiff 2.6.12-orig/drivers/macintosh/apm_emu.c 2.6.12/drivers/macintosh/apm_emu.c
| --- 2.6.12-orig/drivers/macintosh/apm_emu.c	2005-06-17 21:48:29.000000000 +0200
| +++ 2.6.12/drivers/macintosh/apm_emu.c	2005-06-22 09:15:21.000000000 +0200
| @@ -515,19 +515,24 @@ static struct miscdevice apm_device = {
|  
|  static int __init apm_emu_init(void)
|  {
| +	int ret ;
	int ret;
|  	struct proc_dir_entry *apm_proc;
|  
|  	if (sys_ctrler != SYS_CTRLER_PMU) {
|  		printk(KERN_INFO "apm_emu: Requires a machine with a PMU.\n");
|  		return -ENODEV;
|  	}
| -		
| +
| +	ret = misc_register(&apm_device);
| +	if (ret) {
| +		printk(KERN_WARNING "Unable to register misc device.\n");
| +		return ret ;
		return ret;

| + }
| +

---
~Randy

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Christophe Lucas

On Wed, 22 Jun 2005 10:03:46 +0200 Christophe Lucas wrote:

| diff -urpNX dontdiff 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c
| --- 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c	2005-06-17 21:48:29.000000000 +0200
| +++ 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c	2005-06-22 09:16:08.000000000 +0200
| @@ -192,13 +192,25 @@ static int hdpu_cpustate_probe(struct de
|  {
|  	struct platform_device *pdev = to_platform_device(ddev);
|  	struct resource *res;
| +	struct proc_dir_entry *proc_de;
| +	int ret;

Good, thanks.

|  
|  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|  	cpustate.set_addr = (unsigned long *)res->start;
|  	cpustate.clr_addr = (unsigned long *)res->end - 1;
|  
| -	misc_register(&cpustate_dev);
| -	create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
| +	ret = misc_register(&cpustate_dev);
| +	if (ret) {
| +		printk(KERN_WARNING "Unable to register misc device.\n");
| +		cpustate.set_addr = NULL;
| +		cpustate.clr_addr = NULL;
| +		return ret ;
		return ret;
| +	}
| +
| +	proc_de = create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
| +	if (proc_de == NULL) {
| +		printk(KERN_WARNING "Unable to create proc dir entry for hdpu_cpustate device.\n");
| +	}

Break up source lines to fit into 80 columns or less.

---
~Randy

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Christophe Lucas

On Wed, 22 Jun 2005 10:00:00 +0200 Christophe Lucas wrote:

| diff -urpNX dontdiff 2.6.12-orig/drivers/macintosh/apm_emu.c 2.6.12/drivers/macintosh/apm_emu.c
| --- 2.6.12-orig/drivers/macintosh/apm_emu.c	2005-06-17 21:48:29.000000000 +0200
| +++ 2.6.12/drivers/macintosh/apm_emu.c	2005-06-22 09:15:21.000000000 +0200
| @@ -515,19 +515,24 @@ static struct miscdevice apm_device = {
|  
|  static int __init apm_emu_init(void)
|  {
| +	int ret ;
|  	struct proc_dir_entry *apm_proc;
|  
|  	if (sys_ctrler != SYS_CTRLER_PMU) {
|  		printk(KERN_INFO "apm_emu: Requires a machine with a PMU.\n");
|  		return -ENODEV;
|  	}
| -		
| +
| +	ret = misc_register(&apm_device);
| +	if (ret) {
| +		printk(KERN_WARNING "Unable to register misc device.\n");
| +		return ret ;
| +	}
| +

yes, again. The message needs some module identification in it.

---
~Randy

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
In reply to Christophe Lucas

On Wed, 22 Jun 2005 10:03:46 +0200 Christophe Lucas wrote:

| 
| diff -urpNX dontdiff 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c
| --- 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c	2005-06-17 21:48:29.000000000 +0200
| +++ 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c	2005-06-22 09:16:08.000000000 +0200
| @@ -192,13 +192,25 @@ static int hdpu_cpustate_probe(struct de
|  {
|  
| -	misc_register(&cpustate_dev);
| -	create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
| +	ret = misc_register(&cpustate_dev);
| +	if (ret) {
| +		printk(KERN_WARNING "Unable to register misc device.\n");

Message needs module identifier in it.

| +		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 "Unable to create proc dir entry for hdpu_cpustate device.\n");
| +	}

---
~Randy

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#5 lore raw

PATCH RESEND 1/1 Audit return code :

In reply to Christophe Lucas

description:
Audit return codes (and handle failure correctly) for misc_register.

drivers/input/misc/hp_sdc_rtc.c +12 -2
diff -urpNX dontdiff 2.6.12-orig/drivers/input/misc/hp_sdc_rtc.c 2.6.12/drivers/input/misc/hp_sdc_rtc.c
@@ -697,14 +697,24 @@ static struct miscdevice hp_sdc_rtc_dev 
 static int __init hp_sdc_rtc_init(void)
 {
 	int ret;
+	struct proc_dir_entry* proc_de;
 
 	init_MUTEX(&i8042tregs);
 
 	if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr)))
 		return ret;
-	misc_register(&hp_sdc_rtc_dev);
-        create_proc_read_entry ("driver/rtc", 0, 0, 
+	ret = misc_register(&hp_sdc_rtc_dev);
+	if (ret) {
+		printk(KERN_WARNING "hp_sdc_rtc: "
+				"Unable to register misc device.\n");
+		return ret;
+	}
+	proc_de = create_proc_read_entry("driver/rtc", 0, 0, 
 				hp_sdc_rtc_read_proc, NULL);
+	if (proc_de == NULL) {
+		printk(KERN_WARNING "hp_sdc_rtc: "
+				"Unable to create proc dir entry.\n");
+	}
 
 	printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded "
 			 "(RTC v " RTC_VERSION ")\n");

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#6 lore raw

PATCH RESEND 1/1 Audit return code :

In reply to Christophe Lucas

description:
Audit return codes (and handle failure correctly) for misc_register.

drivers/misc/hdpuftrs/hdpu_cpustate.c +16 -4
diff -urpNX dontdiff 2.6.12-orig/drivers/misc/hdpuftrs/hdpu_cpustate.c 2.6.12/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -192,13 +192,25 @@ static int hdpu_cpustate_probe(struct de
 {
 	struct platform_device *pdev = to_platform_device(ddev);
 	struct resource *res;
+	struct proc_dir_entry *proc_de;
+	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	cpustate.set_addr = (unsigned long *)res->start;
 	cpustate.clr_addr = (unsigned long *)res->end - 1;
 
-	misc_register(&cpustate_dev);
-	create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL);
+	ret = misc_register(&cpustate_dev);
+	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");
 	return 0;
@@ -206,8 +218,8 @@ static int hdpu_cpustate_probe(struct de
 static int hdpu_cpustate_remove(struct device *ddev)
 {
 
-	cpustate.set_addr = 0;
-	cpustate.clr_addr = 0;
+	cpustate.set_addr = NULL;
+	cpustate.clr_addr = NULL;
 
 	remove_proc_entry("sky_cpustate", NULL);
 	misc_deregister(&cpustate_dev);

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors