Re: [patch 11/17] scsi: ch.c fix shadowed variable warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-03-30 at 11:59 -0700, Harvey Harrison wrote:
> On Sun, 2008-03-30 at 13:55 -0500, James Bottomley wrote:
> > > > 
> > > > This isn't really the correct fix, is it?  The driver stupidity is
> > > > having a global (although static) variable called err which invites
> > > > problems like this.  How about this fix?
> > > > 
> > > 
> > > If you like that better, sure.
> > 
> > Er, well it's not really a question of like; it's more a question of the
> > programming principle of reducing namespace pollution.
> > 
> > The more global something is (and you start with global headers, then
> > arch headers, then globally exported symbols, then subsystem symbols,
> > etc ...) the more polluting.  So, the only thing that should be allowed
> > to name something totally generic, like 'err' or 'ret' should be right
> > at the lowest level (i.e. unexported symbols of local functions).
> > 
> > Your patch was wrong because you changed the name of the lowest level
> > and left the actual polluting symbol in the next level up, thus inviting
> > another patch or function addition to do it all over again.  The correct
> > way to fix something like this is to rename the more globally polluting
> > symbol to make a clash far less likely.
> 
> True, but being somewhat unfamiliar with scsi code, I chose the more
> localized version that was easier to verify.
> 
> Are you going to apply your above version, or did you want me to redo
> mine that way?

Sure ... I only spent a few seconds with an editor and checked that it
compiled ... if there's a problem with my patch, by all means fix it up
and resubmit it.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux