Skip to contentSkip to conversation

Remove second masking instance of variable i from

PATCH Applied Darren Jenkins\ 2 participants 8 messages Feb 9, 2006 – Feb 21, 2006

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

PATCH 1/1 Remove second masking instance of variable i from

G'day list

from http://linuxicc.sourceforge.net/

Remark #1599: Declaration hides variable "variable name"

unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)

seems to have declared
174: "unsigned int new_l2 = 0, new_l3 = 0, i;"
then
219: "int i, j, n;"
Which masks the earlier "i" variable (weird code but this seems right).

"i" seems to be only used as a positive value (as a loop counter), so "unsigned int" seems ok for the second bit too.

The patch below just removes the second declaration.

arch/i386/kernel/cpu/intel_cacheinfo.c renamed from arch/i386/kernel/cpu/intel_cacheinfo.c.orig +1 -1
@@ -216,7 +216,7 @@ unsigned int __cpuinit init_intel_cachei
 	}
 	if (c->cpuid_level > 1) {
 		/* supports eax=2  call */
-		int i, j, n;
+		int j, n;
 		int regs[4];
 		unsigned char *dp = (unsigned char *)regs;
 

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

#1 lore raw

PATCH 1/1 remove second masking instance of variable in fpu_trig.c

G'day list

from http://linuxicc.sourceforge.net/

Remark #1599: Declaration hides variable "variable name"

static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag)

declares "u_char sign;" twice.
once at 1129, and once at 1216.

The patch below just removes the second declaration.

arch/i386/math-emu/fpu_trig.c renamed from arch/i386/math-emu/fpu_trig.c.orig +0 -1
@@ -1213,7 +1213,6 @@ static void fyl2x(FPU_REG *st0_ptr, u_ch
 	    }
 	  else
 	    {
-	      u_char sign;
 	      sign = getsign(st1_ptr)^SIGN_NEG;
 	      if ( FPU_divide_by_zero(1, sign) < 0 )
 		return;

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

#2 lore raw

PATCH 1/1 remove second masking instance of variable in reg_divide.c

In reply to Darren Jenkins\

G'day list,

from http://linuxicc.sourceforge.net/

Remark #1599: Declaration hides variable "variable name"

"int FPU_div(int flags, int rm, int control_w)"

declares "tag" three times.

33: "int tag, deststnr;"
153: "int tag;"
161: "int tag;"

The patch below removes the second two.

arch/i386/math-emu/reg_divide.c renamed from arch/i386/math-emu/reg_divide.c.orig +0 -2
@@ -150,7 +150,6 @@ int FPU_div(int flags, int rm, int contr
 
       if ( flags & DEST_RM )
 	{
-	  int tag;
 	  tag = FPU_gettag0();
 	  if ( tag == TAG_Special )
 	    tag = FPU_Special(st0_ptr);
@@ -158,7 +157,6 @@ int FPU_div(int flags, int rm, int contr
 	}
       else
 	{
-	  int tag;
 	  tag = FPU_gettagi(rm);
 	  if ( tag == TAG_Special )
 	    tag = FPU_Special(&st(rm));

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

#3 lore raw

PATCH 1/1 remove second masking instance of variable in pci_root.c

In reply to Darren Jenkins\

G'day list.

from http://linuxicc.sourceforge.net/

Remark #1599: Declaration hides variable "variable name"

static int acpi_pci_root_add(struct acpi_device *device)

declares status twice:

159: "acpi_status status = AE_OK;"
and
232: "acpi_status status;"

This patch removes the second instance.

drivers/acpi/pci_root.c renamed from drivers/acpi/pci_root.c.orig +0 -1
@@ -229,7 +229,6 @@ static int acpi_pci_root_add(struct acpi
 		if ((tmp->id.segment == root->id.segment)
 		    && (tmp->id.bus == root->id.bus)) {
 			int bus = 0;
-			acpi_status status;
 
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 					  "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n"));

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

#4 lore raw

PATCH 1/1 remove second masking instance of variable in firestream.c

In reply to Darren Jenkins\

G'day list,

from http://linuxicc.sourceforge.net/

Remark #1599: Declaration hides variable "variable name"

static void submit_qentry (struct fs_dev *dev, struct queue *q, struct FS_QENTRY *qe)

declares wp twice;

594: "u32 wp;"
and
618: "int rp, wp;"

This patch just re-names the second instance.

drivers/atm/firestream.c renamed from drivers/atm/firestream.c.orig +3 -3
@@ -615,11 +615,11 @@ static void submit_qentry (struct fs_dev
 		static int c;
 		if (!(c++ % 100))
 			{
-				int rp, wp;
+				int rp, wptr;
 				rp =  read_fs (dev, Q_RP(q->offset));
-				wp =  read_fs (dev, Q_WP(q->offset));
+				wptr =  read_fs (dev, Q_WP(q->offset));
 				fs_dprintk (FS_DEBUG_TXQ, "q at %d: %x-%x: %x entries.\n", 
-					    q->offset, rp, wp, wp-rp);
+					    q->offset, rp, wptr, wptr-rp);
 			}
 	}
 }

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

#5 lore raw

Re: [KJ][Patch] remove second masking instance of variable in

In reply to Darren Jenkins\
Quoted 13 lines · Darren Jenkins

Remark #1599: Declaration hides variable "variable name"

static int acpi_pci_root_add(struct acpi_device *device)

declares status twice:

159: "acpi_status status = AE_OK;"
and
232: "acpi_status status;"

drivers/acpi/pci_root.c static int acpi_pci_root_add(struct acpi · line 232

Quoted 4 lines
drivers/acpi/pci_root.c renamed from drivers/acpi/pci_root.c.orig +0 -1
@@ -229,7 +229,6 @@ static int acpi_pci_root_add(struct acpi
 		if ((tmp->id.segment == root->id.segment)
 		    && (tmp->id.bus == root->id.bus)) {
 			int bus = 0;
-			acpi_status status;

Applied. You're lucky that noone needs outer "status" value after this loop.

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

#6 lore raw

Re: [KJ][Patch] remove second masking instance of variable in

In reply to Darren Jenkins\

drivers/atm/firestream.c static void submit_qentry (struct fs_dev · line 620

Quoted 12 lines · Darren Jenkins
drivers/atm/firestream.c renamed from drivers/atm/firestream.c.orig +3 -3
@@ -615,11 +615,11 @@ static void submit_qentry (struct fs_dev
 			{
-				int rp, wp;
+				int rp, wptr;
 				rp =  read_fs (dev, Q_RP(q->offset));
-				wp =  read_fs (dev, Q_WP(q->offset));
+				wptr =  read_fs (dev, Q_WP(q->offset));
 				fs_dprintk (FS_DEBUG_TXQ, "q at %d: %x-%x: %x entries.\n", 
-					    q->offset, rp, wp, wp-rp);
+					    q->offset, rp, wptr, wptr-rp);

It's not a pointer, so ending it with "ptr" is not good.

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

#7 lore raw

Re: [KJ][Patch] remove second masking instance of variable in

In reply to Darren Jenkins\
Quoted 2 lines · Alexey Dobriyan

It's not a pointer, so ending it with "ptr" is not good.

Fair point.
Here is a revised patch.

drivers/atm/firestream.c renamed from drivers/atm/firestream.c.orig +3 -3
@@ -615,11 +615,11 @@ static void submit_qentry (struct fs_dev
 		static int c;
 		if (!(c++ % 100))
 			{
-				int rp, wp;
+				int rp, w;
 				rp =  read_fs (dev, Q_RP(q->offset));
-				wp =  read_fs (dev, Q_WP(q->offset));
+				w =  read_fs (dev, Q_WP(q->offset));
 				fs_dprintk (FS_DEBUG_TXQ, "q at %d: %x-%x: %x entries.\n", 
-					    q->offset, rp, wp, wp-rp);
+					    q->offset, rp, w, w-rp);
 			}
 	}
 }

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