summaryrefslogtreecommitdiffstats
path: root/cli.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-06 03:10:08 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-06 03:10:08 +0200
commite78aba2587be9e79e73ba3275b6c9b2de3c5c71a (patch)
tree9addb7cd84ed6f1e83ace469d985615f8c9f85d6 /cli.c
parent7af66933c5687fbba7a6ce3945475086bc67b97e (diff)
downloadpcitool-e78aba2587be9e79e73ba3275b6c9b2de3c5c71a.tar.gz
pcitool-e78aba2587be9e79e73ba3275b6c9b2de3c5c71a.tar.bz2
pcitool-e78aba2587be9e79e73ba3275b6c9b2de3c5c71a.tar.xz
pcitool-e78aba2587be9e79e73ba3275b6c9b2de3c5c71a.zip
Fix segmentation failure in DMA access mode
Diffstat (limited to 'cli.c')
-rw-r--r--cli.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli.c b/cli.c
index 6eb9305..d323f3a 100644
--- a/cli.c
+++ b/cli.c
@@ -1013,7 +1013,11 @@ int main(int argc, char **argv) {
if (addr) {
if ((!strncmp(addr, "dma", 3))&&((addr[3]==0)||isnumber(addr+3))) {
if ((type)&&(amode != ACCESS_DMA)) Usage(argc, argv, "Conflicting access modes, the DMA read is requested, but access type is (%s)", type);
- if ((addr[3] != 0)&&(strcmp(addr + 3, bank))) Usage(argc, argv, "Conflicting DMA channels are specified in read parameter (%s) and bank parameter (%s)", addr + 3, bank);
+ if (bank) {
+ if ((addr[3] != 0)&&(strcmp(addr + 3, bank))) Usage(argc, argv, "Conflicting DMA channels are specified in read parameter (%s) and bank parameter (%s)", addr + 3, bank);
+ } else {
+ if (addr[3] == 0) Usage(argc, argv, "The DMA channel is not specified");
+ }
dma = atoi(addr + 3);
amode = ACCESS_DMA;
} else if ((!strncmp(addr, "bar", 3))&&((addr[3]==0)||isnumber(addr+3))) {