Re: [patch 12/30] Fix drivers/scsi/fdomain.c CONFIG_PCI=n warnings

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

 



On Wed, 2007-08-15 at 10:39 -0700, Andrew Morton wrote:
> On Wed, 15 Aug 2007 11:35:49 -0500 James Bottomley <James.Bottomley@xxxxxxxxxxxx> wrote:
> 
> > On Fri, 2007-08-10 at 14:50 -0700, akpm@xxxxxxxxxxxxxxxxxxxx wrote:
> > > From: Gabriel C <nix.or.die@xxxxxxxxxxxxxx>
> > > 
> > > I get this warnings on current git when CONFIG_PCI is not set :
> > > 
> > > drivers/scsi/fdomain.c:390: warning: 'PCI_dev' defined but not used
> > > drivers/scsi/fdomain.c:1768: warning: 'fdomain_pci_tbl' defined but not used
> > > 
> > > Signed-off-by: Gabriel Craciunescu <nix.or.die@xxxxxxxxxxxxxx>
> > > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > 
> > This function looks decidedly dangerous since it references a
> > non-existent variable when CONFIG_PCI isn't set.  It seems to work
> > because pci_dev_put() is defined to a null macro, but it's not safe:
> > 
> > static int fdomain_16x0_release(struct Scsi_Host *shpnt)
> > {
> > 	if (shpnt->irq)
> > 		free_irq(shpnt->irq, shpnt);
> > 	if (shpnt->io_port && shpnt->n_io_port)
> > 		release_region(shpnt->io_port, shpnt->n_io_port);
> > 	if (PCI_bus)
> > 		pci_dev_put(PCI_dev);
> > 	return 0;
> > }
> > 
> 
> I expect that's why pci_dev_put() is still implemented as a macro.

It's not in my best practices book to refer to a non-existent variable
in the hope that the referring routine is an empty define ... at the
very least it will cause a bit of head scratching for anyone looking
over this driver in future.  Not to say this driver will break if
someone ever substitutes the #define for a static inline ...

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