Received: by 10.223.185.116 with SMTP id b49csp7250036wrg; Thu, 1 Mar 2018 02:22:29 -0800 (PST) X-Google-Smtp-Source: AG47ELtsUCI4ZKSKkakOrkcqShXKm2Ie4b8lHeOXw0ed67W+vmFj2d/GY2NqVT0TFC0PIrdQZNVj X-Received: by 10.101.68.193 with SMTP id g1mr1121912pgs.302.1519899749529; Thu, 01 Mar 2018 02:22:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519899749; cv=none; d=google.com; s=arc-20160816; b=YMRX5eKAusgHI6Tq5XMI4pNWGLsLjmjJbHXA219Fy8RBa3lLYmNJNKxddfiepes2+W +UFH59XYnjGNBpgtYY3/IId0d7tPJdnXIpHqaMOTRe4PWir/1UtI/DPDt9/R89QPR6NV cP7dcX8rfklNrgMNOJxs88+JH149QmNwYsED8TMoEiLaK6aJPqZLj8a/dL9aV15IJrT5 Yrm+mEinRahqI6GHd5oXlMruccfMWAGo4GqwbhFzVjm8S9NcxqwuYkKAbgWQmRzJ/AnW Gts9LvPqrX44gWLjq4RhE2tkYDvZzKdPo6fEDSXFO+PjpTpPZ5gcZMP/pZcjtXLcdaQF N8rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=MmhFP3XZpX6lj4EIurDtDQW15tqwOcBqQSEnq947TfI=; b=Sx2dEuUCNG9L9BpEBVUnd9l+uCeITYrUJNREy9TPd2bUO5eSPKogq8Y2gQpOga36Yq P5J6QNY8I+5wBkPqFqWb7tfVPtpRiR9hZ3tPMsEL3geldn+RHlvlYW+nCnpcnqX27xkz XUvkzeru7e8uCWdy+V0bXI6PaTtiBSp6yQhZgX70CJ+jAvTpRce2k/XPsKKIHWkLuWet WzjpfQkkcbdRE0LVPfPEmLuAFqPSKKerE6/cuPZFtYo+02eNSTSKtKYtPTPXQzEIJ2JZ x/UDJVdEwvzbmyvgQfjWlIm/bRAjlXRoG0g2thL+U4wirkmVzOaXvWdeVZnaVDhF8zaL rkpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b81si2753632pfj.331.2018.03.01.02.22.14; Thu, 01 Mar 2018 02:22:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967313AbeCAKVM (ORCPT + 99 others); Thu, 1 Mar 2018 05:21:12 -0500 Received: from regular1.263xmail.com ([211.150.99.137]:36827 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964815AbeCAKVF (ORCPT ); Thu, 1 Mar 2018 05:21:05 -0500 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.153]) by regular1.263xmail.com (Postfix) with ESMTP id E659BDBF6; Thu, 1 Mar 2018 18:21:00 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 4BE6538B; Thu, 1 Mar 2018 18:20:41 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: <232a954cf78e3e02babb7aa7ba0196f6> X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 24152SQWAA7; Thu, 01 Mar 2018 18:20:47 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Cc: jcliang@chromium.org, robin.murphy@arm.com, xxm@rock-chips.com, tfiga@chromium.org, Jeffy Chen , Heiko Stuebner , linux-rockchip@lists.infradead.org, iommu@lists.linux-foundation.org, Joerg Roedel , linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v6 12/14] iommu/rockchip: Fix error handling in init Date: Thu, 1 Mar 2018 18:18:35 +0800 Message-Id: <20180301101837.27969-13-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180301101837.27969-1-jeffy.chen@rock-chips.com> References: <20180301101837.27969-1-jeffy.chen@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's hard to undo bus_set_iommu() in the error path, so move it to the end of rk_iommu_probe(). Signed-off-by: Jeffy Chen Reviewed-by: Tomasz Figa Reviewed-by: Robin Murphy --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: Move bus_set_iommu() to rk_iommu_probe(). drivers/iommu/rockchip-iommu.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 1346bbb8a3e7..2448a0528e39 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1133,6 +1133,8 @@ static int rk_iommu_probe(struct platform_device *pdev) if (!dma_dev) dma_dev = &pdev->dev; + bus_set_iommu(&platform_bus_type, &rk_iommu_ops); + return 0; err_remove_sysfs: iommu_device_sysfs_remove(&iommu->iommu); @@ -1158,19 +1160,6 @@ static struct platform_driver rk_iommu_driver = { static int __init rk_iommu_init(void) { - struct device_node *np; - int ret; - - np = of_find_matching_node(NULL, rk_iommu_dt_ids); - if (!np) - return 0; - - of_node_put(np); - - ret = bus_set_iommu(&platform_bus_type, &rk_iommu_ops); - if (ret) - return ret; - return platform_driver_register(&rk_iommu_driver); } subsys_initcall(rk_iommu_init); -- 2.11.0