* [PATCH] drivers/scsi/aic7xxx/aic7xxx_osm_pci.c - remove pointer comparison to 0
@ 2008-02-11 5:47 Joe Perches
2008-02-11 15:30 ` James Bottomley
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2008-02-11 5:47 UTC (permalink / raw)
To: Hannes Reinecke, James E.J. Bottomley, linux-scsi
Signed-off-by: Joe Perches <joe@perches.com>
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index dd6e21d..65e194f 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -301,7 +301,7 @@ ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, u_long *base)
*base = pci_resource_start(ahc->dev_softc, 0);
if (*base == 0)
return (ENOMEM);
- if (request_region(*base, 256, "aic7xxx") == 0)
+ if (!request_region(*base, 256, "aic7xxx"))
return (ENOMEM);
return (0);
}
@@ -318,7 +318,7 @@ ahc_linux_pci_reserve_mem_region(struct ahc_softc *ahc,
start = pci_resource_start(ahc->dev_softc, 1);
if (start != 0) {
*bus_addr = start;
- if (request_mem_region(start, 0x1000, "aic7xxx") == 0)
+ if (!request_mem_region(start, 0x1000, "aic7xxx"))
error = ENOMEM;
if (error == 0) {
*maddr = ioremap_nocache(start, 256);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/scsi/aic7xxx/aic7xxx_osm_pci.c - remove pointer comparison to 0
2008-02-11 5:47 [PATCH] drivers/scsi/aic7xxx/aic7xxx_osm_pci.c - remove pointer comparison to 0 Joe Perches
@ 2008-02-11 15:30 ` James Bottomley
2008-02-11 17:08 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: James Bottomley @ 2008-02-11 15:30 UTC (permalink / raw)
To: Joe Perches; +Cc: Hannes Reinecke, linux-scsi
On Sun, 2008-02-10 at 21:47 -0800, Joe Perches wrote:
> - if (request_region(*base, 256, "aic7xxx") == 0)
> + if (!request_region(*base, 256, "aic7xxx"))
This patch is completely pointless. if (x == 0) and if (!x) mean
identical things and there's no style standard preferring one form over
another. There's a marginal preference for if (!x) over if (x == NULL)
for pointers, but it's still up to a driver writer if they wish to use
the marginally unpreferred form.
James
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/scsi/aic7xxx/aic7xxx_osm_pci.c - remove pointer comparison to 0
2008-02-11 15:30 ` James Bottomley
@ 2008-02-11 17:08 ` Joe Perches
2008-02-11 17:17 ` Randy Dunlap
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2008-02-11 17:08 UTC (permalink / raw)
To: James Bottomley; +Cc: Hannes Reinecke, linux-scsi
On Mon, 2008-02-11 at 09:30 -0600, James Bottomley wrote:
> On Sun, 2008-02-10 at 21:47 -0800, Joe Perches wrote:
> > - if (request_region(*base, 256, "aic7xxx") == 0)
> > + if (!request_region(*base, 256, "aic7xxx"))
>
> This patch is completely pointless.
It removes a sparse warning.
> There's a marginal preference for if (!x) over if (x == NULL)
> for pointers, but it's still up to a driver writer if they wish to use
> the marginally unpreferred form.
Use == NULL then if you care to.
cheers, Joe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/scsi/aic7xxx/aic7xxx_osm_pci.c - remove pointer comparison to 0
2008-02-11 17:08 ` Joe Perches
@ 2008-02-11 17:17 ` Randy Dunlap
2008-02-11 17:49 ` James Bottomley
0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2008-02-11 17:17 UTC (permalink / raw)
To: Joe Perches; +Cc: James Bottomley, Hannes Reinecke, linux-scsi
On Mon, 11 Feb 2008 09:08:05 -0800 Joe Perches wrote:
> On Mon, 2008-02-11 at 09:30 -0600, James Bottomley wrote:
> > On Sun, 2008-02-10 at 21:47 -0800, Joe Perches wrote:
> > > - if (request_region(*base, 256, "aic7xxx") == 0)
> > > + if (!request_region(*base, 256, "aic7xxx"))
> >
> > This patch is completely pointless.
>
> It removes a sparse warning.
I try to say that in the patch description. Andrew also tries
to enforce such errors/warnings in patch descriptions....
> > There's a marginal preference for if (!x) over if (x == NULL)
> > for pointers, but it's still up to a driver writer if they wish to use
> > the marginally unpreferred form.
>
> Use == NULL then if you care to.
---
~Randy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drivers/scsi/aic7xxx/aic7xxx_osm_pci.c - remove pointer comparison to 0
2008-02-11 17:17 ` Randy Dunlap
@ 2008-02-11 17:49 ` James Bottomley
0 siblings, 0 replies; 5+ messages in thread
From: James Bottomley @ 2008-02-11 17:49 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Joe Perches, Hannes Reinecke, linux-scsi
On Mon, 2008-02-11 at 09:17 -0800, Randy Dunlap wrote:
> On Mon, 11 Feb 2008 09:08:05 -0800 Joe Perches wrote:
>
> > On Mon, 2008-02-11 at 09:30 -0600, James Bottomley wrote:
> > > On Sun, 2008-02-10 at 21:47 -0800, Joe Perches wrote:
> > > > - if (request_region(*base, 256, "aic7xxx") == 0)
> > > > + if (!request_region(*base, 256, "aic7xxx"))
> > >
> > > This patch is completely pointless.
> >
> > It removes a sparse warning.
>
> I try to say that in the patch description. Andrew also tries
> to enforce such errors/warnings in patch descriptions....
Well, the aic7xxx subdirectory is a nightmare of CodingStyle non
conformities ... you can see the return (ENOMEM) just in this patch.
That's two problems: the brackets and non negative error returns which
are later converted to negative ones thus inviting sign problems. The
driver is also about 3x bigger than it should be because of the vestiges
of the BSD glue layer. However, I think my life is too short to apply
the 32,554 patches it would take to correct this an issue at a time.
This is one of those drivers we tolerate because we must and we fix up
around the regions we have to touch.
James
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-11 17:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-11 5:47 [PATCH] drivers/scsi/aic7xxx/aic7xxx_osm_pci.c - remove pointer comparison to 0 Joe Perches
2008-02-11 15:30 ` James Bottomley
2008-02-11 17:08 ` Joe Perches
2008-02-11 17:17 ` Randy Dunlap
2008-02-11 17:49 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox