All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] Audit return code : drivers/char/applicom.c
@ 2005-06-21 10:13 Christophe Lucas
  2005-06-21 10:14 ` [KJ] [PATCH] Audit return code : drivers/char/lcd.c Christophe Lucas
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Christophe Lucas @ 2005-06-21 10:13 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

description:
Audit return codes (and handle failure correctly) for misc_register.
 
Signed-off-by: Christophe Lucas <clucas@rotomalug.org>


[-- Attachment #2: patch_drivers_char_applicom.c.diff --]
[-- Type: text/plain, Size: 1591 bytes --]

diff -urpNX dontdiff 2.6.12-orig/drivers/char/applicom.c 2.6.12/drivers/char/applicom.c
--- 2.6.12-orig/drivers/char/applicom.c	2005-06-17 21:48:29.000000000 +0200
+++ 2.6.12/drivers/char/applicom.c	2005-06-21 11:25:19.448714976 +0200
@@ -172,7 +172,7 @@ static int ac_register_board(unsigned lo
 
 void cleanup_module(void)
 {
-	int i;
+	unsigned int i;
 
 	misc_deregister(&ac_miscdev);
 
@@ -195,7 +195,7 @@ int __init applicom_init(void)
 	int i, numisa = 0;
 	struct pci_dev *dev = NULL;
 	void __iomem *RamIO;
-	int boardno;
+	int boardno, ret;
 
 	printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n");
 
@@ -294,7 +294,7 @@ int __init applicom_init(void)
 	}
 
 	if (!numisa)
-		printk(KERN_WARNING"ac.o: No valid ISA Applicom boards found at mem 0x%lx\n",mem);
+		printk(KERN_WARNING "ac.o: No valid ISA Applicom boards found at mem 0x%lx\n",mem);
 
  fin:
 	init_waitqueue_head(&FlagSleepRec);
@@ -304,7 +304,10 @@ int __init applicom_init(void)
 	DeviceErrorCount = 0;
 
 	if (numboards) {
-		misc_register(&ac_miscdev);
+		if (ret = misc_register(&ac_miscdev)) {
+			printk(KERN_WARNING "Unable to register misc device\n");
+			goto out;
+		}
 		for (i = 0; i < MAX_BOARD; i++) {
 			int serial;
 			char boardname[(SERIAL_NUMBER - TYPE_CARD) + 1];
@@ -337,6 +340,17 @@ int __init applicom_init(void)
 
 	else
 		return -ENXIO;
+
+out:
+	for (i = 0 ; i < MAX_BOARD ; i++) {
+		if (apbs[i].RamIO)
+			continue;
+		if (apbs[i].irq)
+			free_irq(apbs[i].irq, &dummy);
+		iounmap(apbs[i].RamIO);
+	}
+	pci_disable_device(dev);
+	return ret ;
 }
 
 

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [KJ] [PATCH] Audit return code : drivers/char/lcd.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
@ 2005-06-21 10:14 ` Christophe Lucas
  2005-06-21 10:16 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Christophe Lucas
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Christophe Lucas @ 2005-06-21 10:14 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

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

Signed-off-by: Christophe Lucas <clucas@rotomalug.org>



[-- Attachment #2: patch_drivers_char_lcd.c.diff --]
[-- Type: text/plain, Size: 626 bytes --]

diff -urpNX dontdiff 2.6.12-orig/drivers/char/lcd.c 2.6.12/drivers/char/lcd.c
--- 2.6.12-orig/drivers/char/lcd.c	2005-06-17 21:48:29.000000000 +0200
+++ 2.6.12/drivers/char/lcd.c	2005-06-21 11:28:26.196325024 +0200
@@ -613,10 +613,14 @@ static struct miscdevice lcd_dev = {
 
 static int lcd_init(void)
 {
+	int ret ;
 	unsigned long data;
 
 	pr_info("%s\n", LCD_DRIVER);
-	misc_register(&lcd_dev);
+	if (ret = misc_register(&lcd_dev)) {
+		printk(KERN_WARNING "Unable to register misc device.\n");
+		return ret ;
+	}
 
 	/* Check region? Naaah! Just snarf it up. */
 /*	request_region(RTC_PORT(0), RTC_IO_EXTENT, "lcd");*/

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
  2005-06-21 10:14 ` [KJ] [PATCH] Audit return code : drivers/char/lcd.c Christophe Lucas
@ 2005-06-21 10:16 ` Christophe Lucas
  2005-06-21 10:17 ` [KJ] [PATCH] Audit return code : drivers/macintosh/apm_emu.c Christophe Lucas
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Christophe Lucas @ 2005-06-21 10:16 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 139 bytes --]

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

Signed-off-by: Christophe Lucas <clucas@rotomalug.org>


[-- Attachment #2: patch_drivers_input_misc_hp_sdc_rtc.c.diff --]
[-- Type: text/plain, Size: 653 bytes --]

diff -urpNX dontdiff 2.6.12-orig/drivers/input/misc/hp_sdc_rtc.c 2.6.12/drivers/input/misc/hp_sdc_rtc.c
--- 2.6.12-orig/drivers/input/misc/hp_sdc_rtc.c	2005-06-17 21:48:29.000000000 +0200
+++ 2.6.12/drivers/input/misc/hp_sdc_rtc.c	2005-06-21 11:31:18.363151688 +0200
@@ -702,7 +702,10 @@ static int __init hp_sdc_rtc_init(void)
 
 	if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr)))
 		return ret;
-	misc_register(&hp_sdc_rtc_dev);
+	if (ret = misc_register(&hp_sdc_rtc_dev)) {
+		printk(KERN_WARNING "Unable to register misc device.\n");
+		return ret ;
+	}
         create_proc_read_entry ("driver/rtc", 0, 0, 
 				hp_sdc_rtc_read_proc, NULL);
 

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [KJ] [PATCH] Audit return code : drivers/macintosh/apm_emu.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
  2005-06-21 10:14 ` [KJ] [PATCH] Audit return code : drivers/char/lcd.c Christophe Lucas
  2005-06-21 10:16 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Christophe Lucas
@ 2005-06-21 10:17 ` Christophe Lucas
  2005-06-21 19:24 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Alexey Dobriyan
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Christophe Lucas @ 2005-06-21 10:17 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 139 bytes --]

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

Signed-off-by: Christophe Lucas <clucas@rotomalug.org>


[-- Attachment #2: patch_drivers_macintosh_apm_emu.c.diff --]
[-- Type: text/plain, Size: 941 bytes --]

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-21 11:36:39.094393128 +0200
@@ -515,6 +515,7 @@ 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) {
@@ -522,12 +523,15 @@ static int __init apm_emu_init(void)
 		return -ENODEV;
 	}
 		
+	if (ret = misc_register(&apm_device)) {
+		printk(KERN_WARNING "Unable to register misc device.\n");
+		return ret ;
+	}
+
 	apm_proc = create_proc_info_entry("apm", 0, NULL, apm_emu_get_info);
 	if (apm_proc)
 		apm_proc->owner = THIS_MODULE;
 
-	misc_register(&apm_device);
-
 	pmu_register_sleep_notifier(&apm_sleep_notifier);
 
 	printk(KERN_INFO "apm_emu: APM Emulation %s initialized.\n", driver_version);

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
                   ` (2 preceding siblings ...)
  2005-06-21 10:17 ` [KJ] [PATCH] Audit return code : drivers/macintosh/apm_emu.c Christophe Lucas
@ 2005-06-21 19:24 ` Alexey Dobriyan
  2005-06-21 19:30 ` [KJ] [PATCH] Audit return code : drivers/char/applicom.c randy_dunlap
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Alexey Dobriyan @ 2005-06-21 19:24 UTC (permalink / raw)
  To: kernel-janitors

On Tuesday 21 June 2005 14:16, Christophe Lucas wrote:
> Audit return codes (and handle failure correctly) for misc_register.

> --- 2.6.12-orig/drivers/input/misc/hp_sdc_rtc.c
> +++ 2.6.12/drivers/input/misc/hp_sdc_rtc.c
> @@ -702,7 +702,10 @@ static int __init hp_sdc_rtc_init(void)
>  
>  	if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr)))
>  		return ret;
> -	misc_register(&hp_sdc_rtc_dev);
> +	if (ret = misc_register(&hp_sdc_rtc_dev)) {

hp_sdc_request_timer_irq() have hp_sdc_release_timer_irq() counterpart.
Double brackets, please. Otherwise gcc will warn. Ditto for other patches.

> +		printk(KERN_WARNING "Unable to register misc device.\n");
> +		return ret ;

And don't add space. Ditto for other patches.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [KJ] [PATCH] Audit return code : drivers/char/applicom.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
                   ` (3 preceding siblings ...)
  2005-06-21 19:24 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Alexey Dobriyan
@ 2005-06-21 19:30 ` randy_dunlap
  2005-06-21 19:42 ` Alexey Dobriyan
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: randy_dunlap @ 2005-06-21 19:30 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 614 bytes --]

On Tue, 21 Jun 2005 12:13:13 +0200 Christophe Lucas wrote:

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


diff -urpNX dontdiff 2.6.12-orig/drivers/char/applicom.c 2.6.12/drivers/char/applicom.c
--- 2.6.12-orig/drivers/char/applicom.c	2005-06-17 21:48:29.000000000 +0200
+++ 2.6.12/drivers/char/applicom.c	2005-06-21 11:25:19.448714976 +0200
@@ -172,7 +172,7 @@ static int ac_register_board(unsigned lo
 
 void cleanup_module(void)
 {
-	int i;
+	unsigned int i;

what is the purpose of this change?  no description for it.


+	return ret ;

what Alexey said...

---
~Randy

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [KJ] [PATCH] Audit return code : drivers/char/applicom.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
                   ` (4 preceding siblings ...)
  2005-06-21 19:30 ` [KJ] [PATCH] Audit return code : drivers/char/applicom.c randy_dunlap
@ 2005-06-21 19:42 ` Alexey Dobriyan
  2005-06-21 19:44 ` randy_dunlap
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Alexey Dobriyan @ 2005-06-21 19:42 UTC (permalink / raw)
  To: kernel-janitors

On Tuesday 21 June 2005 23:30, randy_dunlap wrote:
> On Tue, 21 Jun 2005 12:13:13 +0200 Christophe Lucas wrote:
> --- 2.6.12-orig/drivers/char/applicom.c
> +++ 2.6.12/drivers/char/applicom.c

>  void cleanup_module(void)
>  {
> -	int i;
> +	unsigned int i;
> 
> what is the purpose of this change?  no description for it.

IIRC, gcc 4 sez something about comparing signed and unsigned blah blah, despite

	int i;
	for (i = 0; i < N; i++)

being standard C idiom.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [KJ] [PATCH] Audit return code : drivers/char/applicom.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
                   ` (5 preceding siblings ...)
  2005-06-21 19:42 ` Alexey Dobriyan
@ 2005-06-21 19:44 ` randy_dunlap
  2005-06-21 21:09 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Matthew Wilcox
  2005-06-22  7:04 ` [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
  8 siblings, 0 replies; 10+ messages in thread
From: randy_dunlap @ 2005-06-21 19:44 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

On Tue, 21 Jun 2005 23:42:47 +0400 Alexey Dobriyan wrote:

| On Tuesday 21 June 2005 23:30, randy_dunlap wrote:
| > On Tue, 21 Jun 2005 12:13:13 +0200 Christophe Lucas wrote:
| > --- 2.6.12-orig/drivers/char/applicom.c
| > +++ 2.6.12/drivers/char/applicom.c
| 
| >  void cleanup_module(void)
| >  {
| > -	int i;
| > +	unsigned int i;
| > 
| > what is the purpose of this change?  no description for it.
| 
| IIRC, gcc 4 sez something about comparing signed and unsigned blah blah, despite
| 
| 	int i;
| 	for (i = 0; i < N; i++)
| 
| being standard C idiom.

I suspected that was the case (problem), but the patch description
should say something about that...

---
~Randy

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
                   ` (6 preceding siblings ...)
  2005-06-21 19:44 ` randy_dunlap
@ 2005-06-21 21:09 ` Matthew Wilcox
  2005-06-22  7:04 ` [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
  8 siblings, 0 replies; 10+ messages in thread
From: Matthew Wilcox @ 2005-06-21 21:09 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

On Tue, Jun 21, 2005 at 11:24:50PM +0400, Alexey Dobriyan wrote:
> On Tuesday 21 June 2005 14:16, Christophe Lucas wrote:
> > Audit return codes (and handle failure correctly) for misc_register.
> 
> > --- 2.6.12-orig/drivers/input/misc/hp_sdc_rtc.c
> > +++ 2.6.12/drivers/input/misc/hp_sdc_rtc.c
> > @@ -702,7 +702,10 @@ static int __init hp_sdc_rtc_init(void)
> >  
> >  	if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr)))
> >  		return ret;
> > -	misc_register(&hp_sdc_rtc_dev);
> > +	if (ret = misc_register(&hp_sdc_rtc_dev)) {
> 
> hp_sdc_request_timer_irq() have hp_sdc_release_timer_irq() counterpart.
> Double brackets, please. Otherwise gcc will warn. Ditto for other patches.

In fact, don't do an assignment inside an if.  Ever.

	ret = misc_register(&hp_sdc_rtc_dev);
	if (ret) ...

is much clearer.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [KJ] [PATCH] Audit return code : drivers/char/applicom.c
  2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
                   ` (7 preceding siblings ...)
  2005-06-21 21:09 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Matthew Wilcox
@ 2005-06-22  7:04 ` Christophe Lucas
  8 siblings, 0 replies; 10+ messages in thread
From: Christophe Lucas @ 2005-06-22  7:04 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

randy_dunlap (rdunlap@xenotime.net) wrote:
> On Tue, 21 Jun 2005 23:42:47 +0400 Alexey Dobriyan wrote:
> 
> | On Tuesday 21 June 2005 23:30, randy_dunlap wrote:
> | > On Tue, 21 Jun 2005 12:13:13 +0200 Christophe Lucas wrote:
> | > --- 2.6.12-orig/drivers/char/applicom.c
> | > +++ 2.6.12/drivers/char/applicom.c
> | 
> | >  void cleanup_module(void)
> | >  {
> | > -	int i;
> | > +	unsigned int i;
> | > 
> | > what is the purpose of this change?  no description for it.
> | 
> | IIRC, gcc 4 sez something about comparing signed and unsigned blah blah, despite
> | 
> | 	int i;
> | 	for (i = 0; i < N; i++)
> | 
> | being standard C idiom.
> 
> I suspected that was the case (problem), but the patch description
> should say something about that...

Hi,

Sorry, s/int i/unsigned int i/ is as said by Alexey one entry in kj
TODO. I will resend patch with correct description, put retval
assignment out if if() statement.

Thanks for all your good advise.
 
						- Christophe

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-06-22  7:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-21 10:13 [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas
2005-06-21 10:14 ` [KJ] [PATCH] Audit return code : drivers/char/lcd.c Christophe Lucas
2005-06-21 10:16 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Christophe Lucas
2005-06-21 10:17 ` [KJ] [PATCH] Audit return code : drivers/macintosh/apm_emu.c Christophe Lucas
2005-06-21 19:24 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Alexey Dobriyan
2005-06-21 19:30 ` [KJ] [PATCH] Audit return code : drivers/char/applicom.c randy_dunlap
2005-06-21 19:42 ` Alexey Dobriyan
2005-06-21 19:44 ` randy_dunlap
2005-06-21 21:09 ` [KJ] [PATCH] Audit return code : drivers/input/misc/hp_sdc_rtc.c Matthew Wilcox
2005-06-22  7:04 ` [KJ] [PATCH] Audit return code : drivers/char/applicom.c Christophe Lucas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.