From owner-svn-src-head@FreeBSD.ORG Thu May 24 21:07:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A5D6106564A; Thu, 24 May 2012 21:07:11 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8537C8FC19; Thu, 24 May 2012 21:07:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4OL7BmL060356; Thu, 24 May 2012 21:07:11 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4OL7B7p060354; Thu, 24 May 2012 21:07:11 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201205242107.q4OL7B7p060354@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 24 May 2012 21:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235934 - head/sys/powerpc/mpc85xx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 21:07:11 -0000 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); }