Message ID | alpine.LNX.2.00.1012252125410.10759@swampdragon.chaosbits.net |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
On Sat, 25 Dec 2010, richard -rw- weinberger wrote: > On Sat, Dec 25, 2010 at 9:30 PM, Jesper Juhl <jj@chaosbits.net> wrote: > > Hi, > > > > In drivers/net/3c59x.c::vortex_probe1() we have this code: > > > > if (gendev) { > > if ((pdev = DEVICE_PCI(gendev))) { > > print_name = pci_name(pdev); > > } > > > > if ((edev = DEVICE_EISA(gendev))) { > > print_name = dev_name(&edev->dev); > > } > > } > > > > I believe these assignments were intended to be comparisons. > > If I'm correct, then here's a patch to fix that up. > > I don't think so. Look at the extra brackets. > > The code can also written as: > > pdev = DEVICE_PCI(gendev); > if(pdev) > print_name = pci_name(pdev); > Arrgh, I completely missed that - damn. You are correct I think and my patch is wrong. Thanks for taking a look.
On Sat, Dec 25, 2010 at 9:30 PM, Jesper Juhl <jj@chaosbits.net> wrote: > Hi, > > In drivers/net/3c59x.c::vortex_probe1() we have this code: > > if (gendev) { > if ((pdev = DEVICE_PCI(gendev))) { > print_name = pci_name(pdev); > } > > if ((edev = DEVICE_EISA(gendev))) { > print_name = dev_name(&edev->dev); > } > } > > I believe these assignments were intended to be comparisons. > If I'm correct, then here's a patch to fix that up. I don't think so. Look at the extra brackets. The code can also written as: pdev = DEVICE_PCI(gendev); if(pdev) print_name = pci_name(pdev); > > Signed-off-by: Jesper Juhl <jj@chaosbits.net> > --- > 3c59x.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c > index 0a92436f..db8a80e 100644 > --- a/drivers/net/3c59x.c > +++ b/drivers/net/3c59x.c > @@ -1110,11 +1110,11 @@ static int __devinit vortex_probe1(struct device *gendev, > } > > if (gendev) { > - if ((pdev = DEVICE_PCI(gendev))) { > + if ((pdev == DEVICE_PCI(gendev))) { > print_name = pci_name(pdev); > } > > - if ((edev = DEVICE_EISA(gendev))) { > + if ((edev == DEVICE_EISA(gendev))) { > print_name = dev_name(&edev->dev); > } > } > > > -- > Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/ > Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html > Plain text mails only, please. > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >
On Sat, Dec 25, 2010 at 9:45 PM, Jesper Juhl <jj@chaosbits.net> wrote: > On Sat, 25 Dec 2010, richard -rw- weinberger wrote: > >> On Sat, Dec 25, 2010 at 9:30 PM, Jesper Juhl <jj@chaosbits.net> wrote: >> > Hi, >> > >> > In drivers/net/3c59x.c::vortex_probe1() we have this code: >> > >> > if (gendev) { >> > if ((pdev = DEVICE_PCI(gendev))) { >> > print_name = pci_name(pdev); >> > } >> > >> > if ((edev = DEVICE_EISA(gendev))) { >> > print_name = dev_name(&edev->dev); >> > } >> > } >> > >> > I believe these assignments were intended to be comparisons. >> > If I'm correct, then here's a patch to fix that up. >> >> I don't think so. Look at the extra brackets. >> >> The code can also written as: >> >> pdev = DEVICE_PCI(gendev); >> if(pdev) >> print_name = pci_name(pdev); >> > > Arrgh, I completely missed that - damn. > You are correct I think and my patch is wrong. > Thanks for taking a look. BTW: gcc is smart enough to catch such typos. if(x = 3){ ... } ...would trigger a warning like this one: "warning: suggest parentheses around assignment used as truth value" > > -- > Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/ > Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html > Plain text mails only, please. >
On Sat, Dec 25, 2010 at 09:50:56PM +0100, richard -rw- weinberger wrote: > On Sat, Dec 25, 2010 at 9:30 PM, Jesper Juhl <jj@chaosbits.net> wrote: > > Hi, > > > > In drivers/net/3c59x.c::vortex_probe1() we have this code: > > > > if (gendev) { > > if ((pdev = DEVICE_PCI(gendev))) { > > print_name = pci_name(pdev); > > } > > > > if ((edev = DEVICE_EISA(gendev))) { > > print_name = dev_name(&edev->dev); > > } > > } > > > > I believe these assignments were intended to be comparisons. > > If I'm correct, then here's a patch to fix that up. > > I don't think so. Look at the extra brackets. > > The code can also written as: > > pdev = DEVICE_PCI(gendev); > if(pdev) > print_name = pci_name(pdev); ... which looks much better and could be worth a patch as well.
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 0a92436f..db8a80e 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -1110,11 +1110,11 @@ static int __devinit vortex_probe1(struct device *gendev, } if (gendev) { - if ((pdev = DEVICE_PCI(gendev))) { + if ((pdev == DEVICE_PCI(gendev))) { print_name = pci_name(pdev); } - if ((edev = DEVICE_EISA(gendev))) { + if ((edev == DEVICE_EISA(gendev))) { print_name = dev_name(&edev->dev); } }
Hi, In drivers/net/3c59x.c::vortex_probe1() we have this code: if (gendev) { if ((pdev = DEVICE_PCI(gendev))) { print_name = pci_name(pdev); } if ((edev = DEVICE_EISA(gendev))) { print_name = dev_name(&edev->dev); } } I believe these assignments were intended to be comparisons. If I'm correct, then here's a patch to fix that up. Signed-off-by: Jesper Juhl <jj@chaosbits.net> --- 3c59x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)