Skip to contentSkip to conversation

Fix warning in drivers/ide/pci/siimage.c

Kernel-janitors Luiz Fernando Capitulino 3 participants 10 messages Jan 8, 2004 – Feb 5, 2004

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

Hi all,

the some patch, only the new format in the if(), as noted by Randy.

drivers/ide/pci/siimage.c +9 -12
diff -X dontdiff -Nru linux-2.6.1-rc3/drivers/ide/pci/siimage.c linux-2.6.1-rc3~/drivers/ide/pci/siimage.c
@@ -767,20 +767,17 @@
  
 static void proc_reports_siimage (struct pci_dev *dev, u8 clocking, const char *name)
 {
-	if(pdev_is_sata(dev))
-		goto sata_skip;
-
-	printk(KERN_INFO "%s: BASE CLOCK ", name);
-	clocking &= 0x03;
-	switch(clocking) {
-		case 0x03: printk("DISABLED !\n"); break;
-		case 0x02: printk("= 2X PCI \n"); break;
-		case 0x01: printk("= 133 \n"); break;
-		case 0x00: printk("= 100 \n"); break;
+	if(!pdev_is_sata(dev)) {
+		printk(KERN_INFO "%s: BASE CLOCK ", name);
+		clocking &= 0x03;
+		switch(clocking) {
+			case 0x03: printk("DISABLED !\n"); break;
+			case 0x02: printk("= 2X PCI \n"); break;
+			case 0x01: printk("= 133 \n"); break;
+			case 0x00: printk("= 100 \n"); break;
+		}
 	}
 
-sata_skip:
-
 #if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
 	siimage_devs[n_siimage_devs++] = dev;
 
Signature · 8 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>

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

[Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c when

hi,

Here goes the rediff, it fixes this warning:

drivers/net/pppoe.c: In function `pppoe_init':
drivers/net/pppoe.c:1132: warning: label `out_unregister' defined but not used

Look that I had changed the return values of pppoe_proc_init() to
match with the driver behaviour. Thus, when CONFIG_PROC_FS is not set, pppoe_proc_init() is returning 1, instead of 0.

drivers/net/pppoe.c +20 -14
diff -X dontdiff -Nru linux-2.6.2-rc2-bk2/drivers/net/pppoe.c linux-2.6.2-rc2-bk2~/drivers/net/pppoe.c
@@ -1076,6 +1076,20 @@
 	.llseek		= seq_lseek,
 	.release	= seq_release,
 };
+
+static int __init pppoe_proc_init(void)
+{
+	struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO,
+						     proc_net);
+
+	if (!p)
+		return 1;
+	
+	p->proc_fops = &pppoe_seq_fops;
+	return 0;
+}
+#else /* CONFIG_PROC_FS */
+static int inline pppoe_proc_init(void) { return 1; }
 #endif /* CONFIG_PROC_FS */
 
 /* ->ioctl are set at pppox_create */
@@ -1112,26 +1126,18 @@
 
 	if (err)
 		goto out;
-#ifdef CONFIG_PROC_FS
-{
-	struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO,
-						     proc_net);
-	err = -ENOMEM;
-	if (!p)
-		goto out_unregister;
+
+	if ((err = pppoe_proc_init())) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;
+		goto out;
+	}
 	
-	p->proc_fops = &pppoe_seq_fops;
-	err = 0;
-}
-#endif /* CONFIG_PROC_FS */
 	dev_add_pack(&pppoes_ptype);
 	dev_add_pack(&pppoed_ptype);
 	register_netdevice_notifier(&pppoe_notifier);
 out:
 	return err;
-out_unregister:
-	unregister_pppox_proto(PX_PROTO_OE);
-	goto out;
 }
 
 static void __exit pppoe_exit(void)
Signature · 8 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>

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

Re: [Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c

In reply to Luiz Fernando Capitulino

drivers/net/pppoe.c line 1083

Quoted 12 lines · Luiz Fernando Capitulino

diff -X dontdiff -Nru linux-2.6.2-rc2-bk2/drivers/net/pppoe.c linux-2.6.2-rc2-bk2~/drivers/net/pppoe.c

drivers/net/pppoe.c +5 -0
@@ -1076,6 +1076,20 @@
 	.llseek		= seq_lseek,
 	.release	= seq_release,
 };
+
+static int __init pppoe_proc_init(void)
+{
+	struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO,
+						     proc_net);

While I normally prefer declaration and initialisation on the same line, if you have to split the arguments of the initialisation, better to write it like this:

	struct proc_dir_entry *p;

	p = create_proc_entry("pppoe", S_IRUGO, proc_net);
	if (!p)
		return 1;

drivers/net/pppoe.c line 1084

Quoted 1 line
drivers/net/pppoe.c +1 -0
+static int inline pppoe_proc_init(void) { return 1; }

"static inline int" is preferred.

drivers/net/pppoe.c line 1090

Quoted 6 lines
drivers/net/pppoe.c +6 -0
+
+	if ((err = pppoe_proc_init())) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;
+		goto out;
+	}
	err = pppoe_proc_init();
	if (err) {
		...
	}
Signature · 10 lines
"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
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
#3 lore raw

Re: [Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c

In reply to Luiz Fernando Capitulino

Hi Matthew,

Em Sex, 2004-01-30 às 13:02, Matthew Wilcox escreveu:

Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+static int __init pppoe_proc_init(void)
+{
+	struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO,
+						     proc_net);

While I normally prefer declaration and initialisation on the same line, if you have to split the arguments of the initialisation, better to write it like this:

Quoted 5 lines
	struct proc_dir_entry *p;

	p = create_proc_entry("pppoe", S_IRUGO, proc_net);
	if (!p)
		return 1;

Hummm... very better.

Quoted 3 lines
Quoted 1 line

+static int inline pppoe_proc_init(void) { return 1; }

"static inline int" is preferred.

I was wrong....

I will rediff and send again.

More comments ?

Signature · 9 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>


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

[Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c when

In reply to Luiz Fernando Capitulino

hi all,

this version have the Matthew's hints.

drivers/net/pppoe.c +21 -14
diff -X dontdiff -Nru linux-2.6.2-rc2-bk4/drivers/net/pppoe.c linux-2.6.2-rc2-bk4~/drivers/net/pppoe.c
@@ -1076,6 +1076,20 @@
 	.llseek		= seq_lseek,
 	.release	= seq_release,
 };
+
+static int __init pppoe_proc_init(void)
+{
+	struct proc_dir_entry *p;
+
+	p = create_proc_entry("pppoe", S_IRUGO, proc_net);
+	if (!p)
+		return 1;
+	
+	p->proc_fops = &pppoe_seq_fops;
+	return 0;
+}
+#else /* CONFIG_PROC_FS */
+static inline int pppoe_proc_init(void) { return 1; }
 #endif /* CONFIG_PROC_FS */
 
 /* ->ioctl are set at pppox_create */
@@ -1112,26 +1126,19 @@
 
 	if (err)
 		goto out;
-#ifdef CONFIG_PROC_FS
-{
-	struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO,
-						     proc_net);
-	err = -ENOMEM;
-	if (!p)
-		goto out_unregister;
+
+	err = pppoe_proc_init();
+	if (err) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;
+		goto out;
+	}
 	
-	p->proc_fops = &pppoe_seq_fops;
-	err = 0;
-}
-#endif /* CONFIG_PROC_FS */
 	dev_add_pack(&pppoes_ptype);
 	dev_add_pack(&pppoed_ptype);
 	register_netdevice_notifier(&pppoe_notifier);
 out:
 	return err;
-out_unregister:
-	unregister_pppox_proto(PX_PROTO_OE);
-	goto out;
 }
 
 static void __exit pppoe_exit(void)
Signature · 8 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>

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

Re: [Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c

In reply to Luiz Fernando Capitulino
Quoted 1 line · Luiz Fernando Capitulino

this version have the Matthew's hints.

Sorry to do this to you ...

Review

Quoted 10 lines
(quoted diff) +8 -0
+#else /* CONFIG_PROC_FS */
+static inline int pppoe_proc_init(void) { return 1; }
 #endif /* CONFIG_PROC_FS */
 
+	err = pppoe_proc_init();
+	if (err) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;
+		goto out;
+	}

Shouldn't the stub function return 0 (no error)? Otherwise we'll always unregister the protocol.

Signature · 10 lines
"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
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
#6 lore raw

Re: [Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c

In reply to Luiz Fernando Capitulino

Em Sex, 2004-01-30 às 16:20, Matthew Wilcox escreveu:

Quoted 4 lines · Luiz Fernando Capitulino
Quoted 1 line

this version have the Matthew's hints.

Sorry to do this to you ...

No problems Matthew. :)

Quoted 4 lines
Quoted 3 lines
(quoted diff) +2 -0
+#else /* CONFIG_PROC_FS */
+static inline int pppoe_proc_init(void) { return 1; }
 #endif /* CONFIG_PROC_FS */
Quoted 9 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+	err = pppoe_proc_init();
+	if (err) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;
+		goto out;
+	}

Shouldn't the stub function return 0 (no error)? Otherwise we'll always unregister the protocol.

Oh yes, I made a confusion here.

I thought pppoe_init() jump to 'out_unregister' when !CONFIG_PROC_FS, so I tryed to follow this rule. I don't know where I saw that.

I'll sleep some hours before rediff this (simple) code again. :)

many thanks,

Signature · 9 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>


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

[Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c when

In reply to Luiz Fernando Capitulino

Hi all,

I hope its ok now.

drivers/net/pppoe.c +21 -14
diff -X dontdiff -Nru linux-2.6.2-rc2-bk4/drivers/net/pppoe.c linux-2.6.2-rc2-bk4~/drivers/net/pppoe.c
@@ -1076,6 +1076,20 @@
 	.llseek		= seq_lseek,
 	.release	= seq_release,
 };
+
+static int __init pppoe_proc_init(void)
+{
+	struct proc_dir_entry *p;
+
+	p = create_proc_entry("pppoe", S_IRUGO, proc_net);
+	if (!p)
+		return 1;
+	
+	p->proc_fops = &pppoe_seq_fops;
+	return 0;
+}
+#else /* CONFIG_PROC_FS */
+static inline int pppoe_proc_init(void) { return 0; }
 #endif /* CONFIG_PROC_FS */
 
 /* ->ioctl are set at pppox_create */
@@ -1112,26 +1126,19 @@
 
 	if (err)
 		goto out;
-#ifdef CONFIG_PROC_FS
-{
-	struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO,
-						     proc_net);
-	err = -ENOMEM;
-	if (!p)
-		goto out_unregister;
+
+	err = pppoe_proc_init();
+	if (err) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;
+		goto out;
+	}
 	
-	p->proc_fops = &pppoe_seq_fops;
-	err = 0;
-}
-#endif /* CONFIG_PROC_FS */
 	dev_add_pack(&pppoes_ptype);
 	dev_add_pack(&pppoed_ptype);
 	register_netdevice_notifier(&pppoe_notifier);
 out:
 	return err;
-out_unregister:
-	unregister_pppox_proto(PX_PROTO_OE);
-	goto out;
 }
 
 static void __exit pppoe_exit(void)
Signature · 8 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>

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

Re: [Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c

In reply to Luiz Fernando Capitulino

Luiz Fernando Capitulino <[email protected]> :
[...]

Quoted 3 lines

diff -X dontdiff -Nru linux-2.6.2-rc2-bk4/drivers/net/pppoe.c linux-2.6.2-rc2-bk4~/drivers/net/pppoe.c

drivers/net/pppoe.c +0 -0

[...]

Quoted 6 lines
drivers/net/pppoe.c +0 -2
@@ -1112,26 +1126,19 @@
 
 	if (err)
 		goto out;
-#ifdef CONFIG_PROC_FS
-{

drivers/net/pppoe.c line 1133

Quoted 10 lines
drivers/net/pppoe.c +5 -5
-	struct proc_dir_entry *p = create_proc_entry("pppoe", S_IRUGO,
-						     proc_net);
-	err = -ENOMEM;
-	if (!p)
-		goto out_unregister;
+
+	err = pppoe_proc_init();
+	if (err) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;

-> What about making pppoe_proc_init() return -ENOMEM directly and testing
against (err < 0)

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

#9 lore raw

Re: [Kernel-janitors] [REDIFF] Fix warning in drivers/net/pppoe.c

In reply to Luiz Fernando Capitulino

Em Qua, 2004-02-04 às 19:58, Francois Romieu escreveu:

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+	err = pppoe_proc_init();
+	if (err) {
+		unregister_pppox_proto(PX_PROTO_OE);
+		err = -ENOMEM;

-> What about making pppoe_proc_init() return -ENOMEM directly and testing
against (err < 0)

hummm.... Looks better, I will rediff again. :)))

Someone do not agree ?

Signature · 9 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>


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