Patchwork [U-Boot] net: dc2114x: check for apropriate command

login
register
mail settings
Submitter Linus Walleij
Date Sept. 26, 2011, 7:41 a.m.
Message ID <1317022874-32278-1-git-send-email-linus.walleij@linaro.org>
Download mbox | patch
Permalink /patch/116375/
State Accepted
Commit df6a36fbef32cd7f27b9ce7da22ad16d0b4ed62c
Headers show

Comments

Linus Walleij - Sept. 26, 2011, 7:41 a.m.
The code had two paths depending on whether the card was to be
accessed from plain memory or the IO region. However the error
path checks whether IO region was obtained - twice. Fix up the
error path according to the probable intention.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/net/dc2114x.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
Wolfgang Denk - Oct. 21, 2011, 10:37 p.m.
Dear Linus Walleij,

In message <1317022874-32278-1-git-send-email-linus.walleij@linaro.org> you wrote:
> The code had two paths depending on whether the card was to be
> accessed from plain memory or the IO region. However the error
> path checks whether IO region was obtained - twice. Fix up the
> error path according to the probable intention.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/net/dc2114x.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index 51e7c19..0fb616a 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -245,15 +245,17 @@  int dc21x4x_initialize(bd_t *bis)
 		pci_write_config_word(devbusfn, PCI_COMMAND, status);
 
 		pci_read_config_word(devbusfn, PCI_COMMAND, &status);
+#ifdef CONFIG_TULIP_USE_IO
 		if (!(status & PCI_COMMAND_IO)) {
 			printf("Error: Can not enable I/O access.\n");
 			continue;
 		}
-
-		if (!(status & PCI_COMMAND_IO)) {
-			printf("Error: Can not enable I/O access.\n");
+#else
+		if (!(status & PCI_COMMAND_MEMORY)) {
+			printf("Error: Can not enable MEMORY access.\n");
 			continue;
 		}
+#endif
 
 		if (!(status & PCI_COMMAND_MASTER)) {
 			printf("Error: Can not enable Bus Mastering.\n");