Received: by 10.223.148.5 with SMTP id 5csp7307766wrq; Thu, 18 Jan 2018 03:58:58 -0800 (PST) X-Google-Smtp-Source: ACJfBovvwgljHOIfHHQ6Ql8GMj9ZiQhrqtOvSIb8ern3xG6ADuA6QqindGKAjvunLMY+uLWsJvxY X-Received: by 10.98.160.25 with SMTP id r25mr26502938pfe.218.1516276738310; Thu, 18 Jan 2018 03:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516276738; cv=none; d=google.com; s=arc-20160816; b=j5rtFL2eA/DES1cp1BymauGt31F5V7jEYPr80TRrLLm5rNbIgY0rmNURKuiG80yzso 1wdwfG+wTsogSZH3JLYuTUKyeJ0IzwhFtKR8sNX7ImIYjMzB3FEaVYnI+JJkLhE3ZJ1m N5pfTAkJw9fF4XfTqsfOm4qaH385MjRfKmX+L4M+K6y20Vlezjspm1A9VHDZIvPjF2AD Y6p6enHQLBz+DF2bfPubvEVqXylaEXVeKpm6uaUW+8SSQ8zqRZbqmkJYdtcdnlTHs5Wc 0+qyliiKLM2MCoBxZpJoPj8qAWOt/1XEiBk40aU79H6UYuqhtvEJxaEMxyCQR7KycjnH 56CQ== 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=ZdQ1ZcCaJZnt7XyQkFHat4DzDu+HHlpUkRyjtQ9zB/k=; b=KbjPdIlMQf0yraxd0nsxeIksHnnd9AhSEFYSOIVbhPjV8uOvGWji4qa3VqOgj3gTu0 VRpWv32z2AbgIkjU1ZLmsCafgOhhaT080hqeRywMOopQB37p2LOlUn0rOcuBCy9DeBi5 YpM+qMaBh0PrmDjEFjUhcq9xh6leqa3UCEGGi5mU3yvIFK9EQRhuB7UCHQCXTagfjLg0 w5GU4tqcSbBJVyPVRh3s5wcuoxlTlqywvfY9x71USPUOHgMTkt2VFzKFveh4GOsLefnq EhTnPmJo43V3JBgGxv1kwXivBNQk5ZU1fDzytyvO3JmLTABzGBFJ48ftfj2Hg+azFzC4 ZgDw== 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 x81si6578693pfe.361.2018.01.18.03.58.44; Thu, 18 Jan 2018 03:58:58 -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 S932397AbeARLyn (ORCPT + 99 others); Thu, 18 Jan 2018 06:54:43 -0500 Received: from regular1.263xmail.com ([211.150.99.141]:57430 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932269AbeARLyk (ORCPT ); Thu, 18 Jan 2018 06:54:40 -0500 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.227]) by regular1.263xmail.com (Postfix) with ESMTP id E5DA565; Thu, 18 Jan 2018 19:54:35 +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 62D45360; Thu, 18 Jan 2018 19:54:31 +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: 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 4220QBR9L3; Thu, 18 Jan 2018 19:54:35 +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 v4 11/13] iommu/rockchip: Fix error handling in init Date: Thu, 18 Jan 2018 19:52:49 +0800 Message-Id: <20180118115251.5542-12-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180118115251.5542-1-jeffy.chen@rock-chips.com> References: <20180118115251.5542-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 --- 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 b1f177ae03c7..2c095f96c033 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1195,6 +1195,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); @@ -1220,19 +1222,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