Received: by 10.223.148.5 with SMTP id 5csp5949251wrq; Wed, 17 Jan 2018 07:36:34 -0800 (PST) X-Google-Smtp-Source: ACJfBos/1oVFKJATz0qCdSrWc90PSkWL8oExoKayzUSmBENBlPUgB8aN9Y7ge+s+DbRT9UDF0wrm X-Received: by 10.84.244.139 with SMTP id h11mr3422752pll.259.1516203394346; Wed, 17 Jan 2018 07:36:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516203394; cv=none; d=google.com; s=arc-20160816; b=OiOqX6zGqmvfECYC2VAlawEXmmzSw0/bbOyNGurQ0ayWdd4asKdeIHmIiJ7xpoLCOA JVHfYvemuBJAdLLd3z6buWsDQgUiHOWHNQUKcjpnXzSmEMPYmvNE5VTivuNcdsHTyu9X ukHF0ZVjSa9T4MMSYsvuHX2+ttlVyG8INfOf5uReAviEw6j/S9tmpvZFZsUAUu0AT8gr in+NWMsKSOqsuDbzkaWS5aTTaij/L2TRUyOsCAO2rPde9yvIkRlaTt9/tBvkO8HkquIk +D8Gj8emL7gWA0DpL7oni2/EzkvbDosYnq58g/q+NBtEmQGEs576I33io2DxWlXlVoaq aHaQ== 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=DjwUfHDBR+HZxw3CSpbXhfdyOK+I01RMkY1WKTQ65Z8=; b=QqlmnhOM19wzsQKwmN9t3hQueQi3EwVLqEHU+6mTSQXTVd+DgsBpJGAF6xIPZcXfmb B+IpijCh5zew9aFOI9gRjB9Md79P9ECJO7vlNQt5X4+Kyo9XogAM3cbLkAFY4KM7BzkD ZkNb8tiUUZmbDAvsVK/NKPm8VwtEJZSih+WhZR1kp95tHioDBtdB51Q+J43i3XPUEhoG bHfiITPX5Src+V6G3h2k7h5vX0aVuXVJdAr5dnQd146C9/+WggfL104+WDl3g5GgHeXL nqKzbGv+EKSd7jueFotGcQZNa17hrj3BaeK5uGNfD37okc3DBs9dUHTJ4ytTGsrYyxK1 RMZg== 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 1si4558765plx.176.2018.01.17.07.36.20; Wed, 17 Jan 2018 07:36:34 -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 S1754144AbeAQPf0 (ORCPT + 99 others); Wed, 17 Jan 2018 10:35:26 -0500 Received: from regular1.263xmail.com ([211.150.99.136]:42425 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753668AbeAQP1W (ORCPT ); Wed, 17 Jan 2018 10:27:22 -0500 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.131]) by regular1.263xmail.com (Postfix) with ESMTP id CAF5731; Wed, 17 Jan 2018 23:27:16 +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 37601308; Wed, 17 Jan 2018 23:27:14 +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: <96d81c51d0981fa007df3f61b0a10129> 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 10815SLUZX3; Wed, 17 Jan 2018 23:27:17 +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 v3 10/12] iommu/rockchip: Fix error handling in init Date: Wed, 17 Jan 2018 23:25:40 +0800 Message-Id: <20180117152542.26429-11-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180117152542.26429-1-jeffy.chen@rock-chips.com> References: <20180117152542.26429-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 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