summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/mpc85xx/mpc85xx.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2012-05-24 21:07:10 +0000
committermarcel <marcel@FreeBSD.org>2012-05-24 21:07:10 +0000
commit4015ece7fb42f4524b5af0a3ebad758093c21c68 (patch)
tree36528c38c857ac555c73618fea3a8b83414ab628 /sys/powerpc/mpc85xx/mpc85xx.c
parent2c73b7699aaee4a26a7ec344aac2f1d7d4284a17 (diff)
downloadFreeBSD-src-4015ece7fb42f4524b5af0a3ebad758093c21c68.zip
FreeBSD-src-4015ece7fb42f4524b5af0a3ebad758093c21c68.tar.gz
Just return if the size of the window is 0. This can happen when the
FDT does not define all ranges possible for a particular node (e.g. PCI). While here, only update the trgt_mem and trgt_io pointers if there's no error. This avoids that we knowingly write an invalid target (= -1).
Diffstat (limited to 'sys/powerpc/mpc85xx/mpc85xx.c')
-rw-r--r--sys/powerpc/mpc85xx/mpc85xx.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/powerpc/mpc85xx/mpc85xx.c b/sys/powerpc/mpc85xx/mpc85xx.c
index e62f952..0db5d5e 100644
--- a/sys/powerpc/mpc85xx/mpc85xx.c
+++ b/sys/powerpc/mpc85xx/mpc85xx.c
@@ -88,6 +88,9 @@ law_enable(int trgt, u_long addr, u_long size)
uint32_t bar, sr;
int i, law_max;
+ if (size == 0)
+ return (0);
+
law_max = law_getmax();
bar = _LAW_BAR(addr);
sr = _LAW_SR(trgt, size);
@@ -168,7 +171,10 @@ law_pci_target(struct resource *res, int *trgt_mem, int *trgt_io)
default:
rv = ENXIO;
}
- *trgt_mem = *trgt_io = trgt;
+ if (rv == 0) {
+ *trgt_mem = trgt;
+ *trgt_io = trgt;
+ }
return (rv);
}
OpenPOWER on IntegriCloud