From patchwork Tue Mar 4 14:54:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 3762611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D40439F382 for ; Tue, 4 Mar 2014 14:55:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8C1620411 for ; Tue, 4 Mar 2014 14:55:20 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A397C203DF for ; Tue, 4 Mar 2014 14:55:19 +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 1WKqkO-00079E-Rl; Tue, 04 Mar 2014 14:55:08 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKqkM-0006sX-BD; Tue, 04 Mar 2014 14:55:06 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKqkJ-0006rS-7r for linux-arm-kernel@lists.infradead.org; Tue, 04 Mar 2014 14:55:04 +0000 Received: by mail-pa0-f50.google.com with SMTP id kq14so5365342pab.9 for ; Tue, 04 Mar 2014 06:54:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M+8CZLsAHr4UylBqnsD32zuJkDsRe+0hKEUYnVJ8kQE=; b=J/cYP7pFtcAaFfm8YxiNTYVLatzvibPvx0RYgSkQ2zTadwob0WdovzxwUcB5xpE1cQ ja185Uj1TRdQ2XtSCupdpNNMIjl6APsQosX44VggnhJ08ajOwwNIXiMjzYZHuBMUc9b+ /JAmIfOpHQfe2SSghx/08Kpj4v4e6njUxF92dWr7E4T5yUKVAfkI6WuRuk9E6c3b5t0p R8U4MI1MYU52sSq6l0yh81yqFxd4m0pz2F4cAhllHFGVSxJOvg0mdgS1cCo0ElzUG+KD qvl+45DyBZnaLySQKs2umEwry8l1aWFkip6e9lrkH8AYLzjbqN9CZxqoCI00vFsX+G4w nz1w== X-Gm-Message-State: ALoCoQlP6UanWk7yl95T3Z2DR8uqzhf9Mhbe82Akvf01U7Ri8NVdZednoPNJ2+6nrflkLmksBzc0 X-Received: by 10.68.197.36 with SMTP id ir4mr33480pbc.46.1393944877887; Tue, 04 Mar 2014 06:54:37 -0800 (PST) Received: from localhost.localdomain (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by mx.google.com with ESMTPSA id sy2sm48719975pbc.28.2014.03.04.06.54.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 06:54:36 -0800 (PST) From: Tim Harvey To: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org Subject: [PATCH 1/2] of/irq: Fix irq-mapping in of_irq_parse_raw() Date: Tue, 4 Mar 2014 06:54:24 -0800 Message-Id: <1393944864-28113-1-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140304_095503_375421_2DB12162 X-CRM114-Status: GOOD ( 13.11 ) X-Spam-Score: 0.4 (/) Cc: Mark Rutland , Richard Zhu , linux-samsung-soc , Grant Likely , Ben Dooks , Arnd Bergmann , Stephen Warren , Jingoo Han , Jason Gunthorpe , linux-tegra , Simon Horman , Thierry Reding , Sascha Hauer , Bjorn Helgaas , Kukjin Kim , Shawn Guo , Lucas Stach 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When an interrupt-map contains multiple entries an imap pointer arithmetic bug can cause only the first entry to be properly evaluated and causes the out_irq parameters to be incorrect depending on the #interrupt-cells and #address-cells of the parent interrupt controller. Specifically, the imap pointer into the interrupt-map table should be adjusted by the parent interrupt controller #interrupt-cells size only as at this point the only the parent unit interrupt specifier needs to be stepped over. This resolves an issue encountered when using the of_irq_parse_and_map_pci() for the imx6 pcie host controller driver map_irq function where a P2P bridge is on the bus and legacy PCI interrupts are to be used. Signed-off-by: Tim Harvey Cc: Jason Gunthorpe Cc: Jingoo Han Cc: Lucas Stach Cc: Mark Rutland Cc: linux-samsung-soc Cc: Richard Zhu Cc: Sascha Hauer Cc: Arnd Bergmann Cc: Stephen Warren Cc: Bjorn Helgaas Cc: Simon Horman Cc: Thierry Reding Cc: Ben Dooks Cc: linux-tegra Cc: Kukjin Kim Cc: Shawn Guo Cc: Grant Likely --- drivers/of/irq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 9bcf2cf..8829197 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -237,11 +237,11 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) /* Check for malformed properties */ if (WARN_ON(newaddrsize + newintsize > MAX_PHANDLE_ARGS)) goto fail; - if (imaplen < (newaddrsize + newintsize)) + if (imaplen < newintsize) goto fail; - imap += newaddrsize + newintsize; - imaplen -= newaddrsize + newintsize; + imap += newintsize; + imaplen -= newintsize; pr_debug(" -> imaplen=%d\n", imaplen); }