From patchwork Tue Sep 17 18:38:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 2903451 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0AE35BFF05 for ; Tue, 17 Sep 2013 18:39:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 82FEC202CF for ; Tue, 17 Sep 2013 18:39:29 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B7822027D for ; Tue, 17 Sep 2013 18:39:28 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM0BJ-0006Tb-Nc; Tue, 17 Sep 2013 18:39:25 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM0BH-0004t6-Fg; Tue, 17 Sep 2013 18:39:23 +0000 Received: from quartz.orcorp.ca ([184.70.90.242]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM0BE-0004s7-4w for linux-arm-kernel@lists.infradead.org; Tue, 17 Sep 2013 18:39:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=mL82+5AH3IcZT0SxlYZDDvfZ5j3YrWJ3FtzdyW7VnWU=; b=IcPp74rNXeftteSEVt+J6FXTw83TPEDI8y3GY07coL5DNpgvXzJ6xz2fyh5wnB5ETPLMlAk4rmzdkEsM0jzOvhgafVous6xh1Akyd5E6cUJ2Bh3QTd9WVip96MPnBzVpQy5fuFi2p9h/qe4fnB+BN5iuVhJz24sulrmJbz4V4WY=; Received: from [10.0.0.161] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VM0Ao-0005UK-7K; Tue, 17 Sep 2013 12:38:54 -0600 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.80) (envelope-from ) id 1VM0An-0000Uv-Rz; Tue, 17 Sep 2013 12:38:53 -0600 Date: Tue, 17 Sep 2013 12:38:53 -0600 From: Jason Gunthorpe To: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Jason Cooper , Ezequiel Garcia , Neil Greatorex Subject: [PATCH] bus: mvebu-mbus: Fix optional pcie-mem/io-aperture properties Message-ID: <20130917183853.GC21230@obsidianresearch.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.161 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130917_143920_285391_6D1BCC66 X-CRM114-Status: GOOD ( 10.75 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the property was not specified then then the returned resource had a resource_size(..) == 1, rather than 0. The PCI-E driver checks for 0 so it blindly continues on with a corrupted resource. Signed-off-by: Jason Gunthorpe --- drivers/bus/mvebu-mbus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c index 19ab6ff..7a66203 100644 --- a/drivers/bus/mvebu-mbus.c +++ b/drivers/bus/mvebu-mbus.c @@ -866,6 +866,8 @@ static void __init mvebu_mbus_get_pcie_resources(struct device_node *np, */ memset(mem, 0, sizeof(struct resource)); memset(io, 0, sizeof(struct resource)); + mem->end--; + io->end--; ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg)); if (!ret) {