From patchwork Sat Mar 25 05:31:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 9644395 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D7A260328 for ; Sat, 25 Mar 2017 05:32:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 602A0205AB for ; Sat, 25 Mar 2017 05:32:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 554A026220; Sat, 25 Mar 2017 05:32:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 848552621D for ; Sat, 25 Mar 2017 05:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966965AbdCYFcQ (ORCPT ); Sat, 25 Mar 2017 01:32:16 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38229 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966986AbdCYFcE (ORCPT ); Sat, 25 Mar 2017 01:32:04 -0400 Received: by mail-wm0-f51.google.com with SMTP id t189so5790383wmt.1 for ; Fri, 24 Mar 2017 22:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XHHlFUc/1vVyXUuc3uwVv8qnEXxJeEK0VoljnTLxdVo=; b=SRCkRtlaf54KwYH2am2JSlsPEV844Sdz/1JDu6Mq4pz59H2X0gLS0Uir7SWT1brtcP PSeRzYroNQLxbe5OMlLukcDnjcp6vj4m8fhbjfwOaW2Z1hpj/OLFDW7zdLz7YQtt4b3X 9+RlKyNSWh2wpWL81pkm5tWPtgNGwahv2LaSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XHHlFUc/1vVyXUuc3uwVv8qnEXxJeEK0VoljnTLxdVo=; b=qX3PsBfFzkjwYk8NUKtlx2HUjTvdVpuuZidneJ3hI47KkYKKZXlnlvHWcVz1qJhp5F NCgRPCi7UeRZHE/WrraFwksPeQKlDW9PRtozaQnRO7MOLdSo0FkhIWTgfGeqVJ3oiOns pcomgOrFBn6l4mlT8yZC7sfcrkwEjiZDIfk0+VIs8O0WXFgHBy4vaRLE05t093rf4Jas YJ7qfZUMnd5sKGkMsWSVKA7uNk7N1KSoCTrtICoqiMxGMeED2f9V3yJQdgqXFHDXrc74 WkVMlCYoRh1dnqYYEgicHDL4agTskHD85huzDJ25xF1wIMYJ9q+Fkci2I+h7QamIsmXt yWDg== X-Gm-Message-State: AFeK/H1zhsoaKgITvgZ1b3r+8o4RD2yIwEV+EjEeKUQHXG4d7x6xoIYDedwnoL1IdOw85uSs X-Received: by 10.28.224.69 with SMTP id x66mr651291wmg.21.1490419917511; Fri, 24 Mar 2017 22:31:57 -0700 (PDT) Received: from anjanavk-OptiPlex-7010.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id x1sm5479205wrd.63.2017.03.24.22.31.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 22:31:56 -0700 (PDT) From: Oza Pawandeep To: Joerg Roedel , Robin Murphy Cc: iommu@lists.linux-foundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, Oza Pawandeep Subject: [RFC PATCH 3/3] of: fix node traversing in of_dma_get_range Date: Sat, 25 Mar 2017 11:01:33 +0530 Message-Id: <1490419893-5073-3-git-send-email-oza.oza@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490419893-5073-1-git-send-email-oza.oza@broadcom.com> References: <1490419893-5073-1-git-send-email-oza.oza@broadcom.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP it jumps to the parent node without examining the child node. also with that, it throws "no dma-ranges found for node" for pci dma-ranges. this patch fixes device node traversing for dma-ranges. Reviewed-by: Anup Patel Signed-off-by: Oza Pawandeep diff --git a/drivers/of/address.c b/drivers/of/address.c index 02b2903..3293d55 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -836,9 +836,6 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz while (1) { naddr = of_n_addr_cells(node); nsize = of_n_size_cells(node); - node = of_get_next_parent(node); - if (!node) - break; ranges = of_get_property(node, "dma-ranges", &len); @@ -852,6 +849,10 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz */ if (!ranges) break; + + node = of_get_next_parent(node); + if (!node) + break; } if (!ranges) {