aboutsummaryrefslogtreecommitdiff
path: root/cmd/pci.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-08-27 08:05:15 -0400
committerTom Rini <trini@konsulko.com>2022-08-27 08:05:15 -0400
commitcd3872ce7e5bf90424a10eda0fe405d04e82adb9 (patch)
tree752f7cfa2ab81b6b3b0608030e4d9dd135b9cfb4 /cmd/pci.c
parentaea087a665c447dfb89bf2113cad74ad53fa17a0 (diff)
parent53a9f9ef879fbc9ae0e6bf5330d3817ebd726e5f (diff)
Merge branch '2022-08-26-assorted-fixes'
- PCIe, NVMe and 2 UBIFS related fixes
Diffstat (limited to 'cmd/pci.c')
-rw-r--r--cmd/pci.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/cmd/pci.c b/cmd/pci.c
index a99e8f8ad6..6258699fec 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -358,6 +358,9 @@ static int pci_cfg_display(struct udevice *dev, ulong addr,
if (length == 0)
length = 0x40 / byte_size; /* Standard PCI config space */
+ if (addr >= 4096)
+ return 1;
+
/* Print the lines.
* once, and all accesses are with the specified bus width.
*/
@@ -378,7 +381,10 @@ static int pci_cfg_display(struct udevice *dev, ulong addr,
rc = 1;
break;
}
- } while (nbytes > 0);
+ } while (nbytes > 0 && addr < 4096);
+
+ if (rc == 0 && nbytes > 0)
+ return 1;
return (rc);
}
@@ -390,6 +396,9 @@ static int pci_cfg_modify(struct udevice *dev, ulong addr, ulong size,
int nbytes;
ulong val;
+ if (addr >= 4096)
+ return 1;
+
/* Print the address, followed by value. Then accept input for
* the next value. A non-converted value exits.
*/
@@ -427,7 +436,10 @@ static int pci_cfg_modify(struct udevice *dev, ulong addr, ulong size,
addr += size;
}
}
- } while (nbytes);
+ } while (nbytes && addr < 4096);
+
+ if (nbytes)
+ return 1;
return 0;
}