summaryrefslogtreecommitdiffstats
path: root/pcitool
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-02 02:49:28 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-02 02:49:28 +0100
commit3c58980b3ca558096340e51c215897e8614ba00a (patch)
tree54d5f8cf48c7331586ed110a548b33b161f8093e /pcitool
parentadc657ebcd01ecc2cc5f110453ef00dffde2d5c0 (diff)
parenta5da7db50d02878b6d9c844b18d0d3f8ccf6c62b (diff)
downloadpcitool-3c58980b3ca558096340e51c215897e8614ba00a.tar.gz
pcitool-3c58980b3ca558096340e51c215897e8614ba00a.tar.bz2
pcitool-3c58980b3ca558096340e51c215897e8614ba00a.tar.xz
pcitool-3c58980b3ca558096340e51c215897e8614ba00a.zip
Distinguish between hardware and bus addresses in pcilib and fix cli reading from DMA when very low DMA timeout is set
Diffstat (limited to 'pcitool')
-rw-r--r--pcitool/cli.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pcitool/cli.c b/pcitool/cli.c
index 3f1af74..caa55a9 100644
--- a/pcitool/cli.c
+++ b/pcitool/cli.c
@@ -1291,9 +1291,11 @@ int ReadData(pcilib_t *handle, ACCESS_MODE mode, FLAGS flags, pcilib_dma_engine_
size = 2048; bytes = 0;
do {
- size *= 2;
- buf = realloc(buf, size);
- if (!buf) Error("Allocation of %zu bytes of memory has failed", size);
+ if ((size - bytes) < 4096) {
+ size *= 2;
+ buf = realloc(buf, size);
+ if (!buf) Error("Allocation of %zu bytes of memory has failed", size);
+ }
err = pcilib_read_dma_custom(handle, dmaid, addr, size - bytes, dma_flags, timeout, buf + bytes, &ret);
bytes += ret;