Author: marcel
Date: Thu May 24 21:07:10 2012
New Revision: 235934
URL: http://svn.freebsd.org/changeset/base/235934

Log:
  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).

Modified:
  head/sys/powerpc/mpc85xx/mpc85xx.c

Modified: head/sys/powerpc/mpc85xx/mpc85xx.c
==============================================================================
--- head/sys/powerpc/mpc85xx/mpc85xx.c  Thu May 24 21:01:35 2012        
(r235933)
+++ head/sys/powerpc/mpc85xx/mpc85xx.c  Thu May 24 21:07:10 2012        
(r235934)
@@ -88,6 +88,9 @@ law_enable(int trgt, u_long addr, u_long
        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
        default:
                rv = ENXIO;
        }
-       *trgt_mem = *trgt_io = trgt;
+       if (rv == 0) {
+               *trgt_mem = trgt;
+               *trgt_io = trgt;
+       }
        return (rv);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to