Received: by 10.223.176.46 with SMTP id f43csp569522wra; Wed, 24 Jan 2018 02:38:08 -0800 (PST) X-Google-Smtp-Source: AH8x227IrDvHOBh45atiIztvkMIJe5uzoj/3tcIk12k1sdEuv0zo0Q0M817CuqF0RqwV9KMP4JY1 X-Received: by 10.99.65.65 with SMTP id o62mr6773215pga.392.1516790288486; Wed, 24 Jan 2018 02:38:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516790288; cv=none; d=google.com; s=arc-20160816; b=SnC07ueXv3N4V96rVnxZ1w98yK19WP3SEsjqZMhYtaRx8Dap/f5UZBdpkUSZvvIYTm gJrvpEMgfKrwKdKZkQ3VSQZXNcS96RMBU/VtJtbwVvt/X8n81fHnfGthBAWpbWWH8aj/ QFsuiUO4mpwHGSmvVeJG/uHnFaBlyic6hdgwwvNqEyVWHqj430TBmvWoQJhc+wMufeZH JVbndF7qw5g5B3krsMR0PXIER8VEaXwJpkaBQeXFdKOWw/xfSuDWOWhA5NgBFmcAjjrn lGBF07OsrC3n719A5FwCfKt9fr53NU8IpROzujRyvQKitSIPZ9pujkk/tFkZTxknw7dk Oxlg== 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=RZZVvb4QaB3nNjf2bZnRSQ7gqgspUys+H3kOCZQ4uGo=; b=aXqmwTj1+KzcACK/SofAs1ajlBs3v/fRYhqjzVknakFciTXGsb9U8INK3erwB8dRvV tP8DW5xrOZeV4C1CMzD1QflpKEyQbX6D5QYL5GJoI/HmP80syF6ewTL7ju2dMSGRwgcg mxsB0kh+uK2oFP23lSoSx9i+OYu6I/dMV5C1dTbZ6RA1NeCJ/lPAQ5G1sdWW5mVDqrlG yY+y4GW8JbXRun8K2iu3MEpW9ZymLkiCbRYWHTvUVHKlobZQTIItw25IaQEElzxO85pk Ceh5HW91eq1B+K3poX+Kmq5ylnilkj0wcbtnAfDE7cmaqxBATnbQct4jb1OiquqJZJx2 TUMQ== 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 x22si2669494pfh.312.2018.01.24.02.37.54; Wed, 24 Jan 2018 02:38:08 -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 S933322AbeAXKhF (ORCPT + 99 others); Wed, 24 Jan 2018 05:37:05 -0500 Received: from regular1.263xmail.com ([211.150.99.132]:35295 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932859AbeAXKhC (ORCPT ); Wed, 24 Jan 2018 05:37:02 -0500 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.140]) by regular1.263xmail.com (Postfix) with ESMTP id 7AD9793DE; Wed, 24 Jan 2018 18:36:58 +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 65C6D359; Wed, 24 Jan 2018 18:36:53 +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: <94e318b07ac727ce9e2da01566421d5d> 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 56668UN8R5; Wed, 24 Jan 2018 18:37:00 +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: [PATCH v5 11/13] iommu/rockchip: Fix error handling in init Date: Wed, 24 Jan 2018 18:35:14 +0800 Message-Id: <20180124103516.2571-12-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180124103516.2571-1-jeffy.chen@rock-chips.com> References: <20180124103516.2571-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 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 faebb6dd1f69..9fea7d8206e9 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1151,6 +1151,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); @@ -1178,19 +1180,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