Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3339769rwa; Tue, 23 Aug 2022 03:09:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7oLFMc0bvieSYIxCmTVuE+9QqdqlQ/i+PpekVbyWrF9Mjv/cidmzwMGeAHitLLqqZrK8OG X-Received: by 2002:a05:6402:23aa:b0:446:80f9:4323 with SMTP id j42-20020a05640223aa00b0044680f94323mr2993514eda.235.1661249365607; Tue, 23 Aug 2022 03:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661249365; cv=none; d=google.com; s=arc-20160816; b=XhG4ltva7ly5UGdIHvVMc+kJ1axv/rPoZRsyjaqKqwkFkK4gYRre51RWrCkp/bxSaD lHIn4D8AyMZDEmQtZiSfHtdam5d8iUe6SLh1THMyTiawpBzZ2xrVjCYCgUTeY28xauaZ oZIkj/RrVhA3InzL8nC2ZiatkcV5Wr4L7fYUtXt8eQHEm4EtCoCS0r0BhgcOQN9R4D1h tvYlQo78xnkD0/lLyur4Nd/q63vxzyRQN1qoTWWAbEuXiAn+e/SD0Tg+ssHfiCqp9AzV jUHNf8sRiuHScsa8545jhqmyXlCB2LVOtLQT/ZmpYKG0kXyF2W2aGGLn28GZMzwr+Ooq EXng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iC14706W/8grf9/VJI1ScAKsZjW8Vnd7XnsNp8w5fZ8=; b=kY77GGS9FnIcgRYorrv73yASYsxVTuIG/HTWXWQzssNA5rtEdWPFL9roBniWTnoOR8 tOhjcXMt1n0H5bWzUxHWGk0+muicQQBCi3rMmTd0bLOuFZjE+bDgwUFNAsrsl4IIzIBz U1Rv1UmKJCgIpCM+n+y/GeYK+v38Hplq48LIOu2bEhno9e5QDieSINHfPZJQp9kpQM7a 2zmjlE6AUsXC9MsvzJHi1R+fw53Rzf1pUjMHV93cJcOhPU3YZhdDm+CascdFoI4ScNuD dx5D502SBSDZrss2lCNbONNLz3zue2vO+0IrgNXZOnkZfN+PT602Nth/MogGCHdUSyYD Fldg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fKGGTZ0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090658c500b0073beb58e98dsi12997037ejs.276.2022.08.23.03.08.59; Tue, 23 Aug 2022 03:09:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fKGGTZ0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352083AbiHWKGy (ORCPT + 99 others); Tue, 23 Aug 2022 06:06:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352379AbiHWKBt (ORCPT ); Tue, 23 Aug 2022 06:01:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796A49AFB3; Tue, 23 Aug 2022 01:49:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31C5461377; Tue, 23 Aug 2022 08:49:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25230C433C1; Tue, 23 Aug 2022 08:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244565; bh=sxbDryvPEIEmBnIz8HeE+kR0f8qisaLYYvklp0l/9+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fKGGTZ0Pt6e6UtMOnmI/YXvyKbzIbRK8oCNztkkwF4QQHPa3MqxBNZEho+oSChKWr CZ4oDzz0LlMVw27X9stBFRHDeWphwzKF9QGPA/2lwMzUqsGmfJnK7cf1EG7AOiRp43 AL87kq0TvHhePUg8aQaETIOFtiLLvUKKbtCVOnmw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Protsenko , Krzysztof Kozlowski , Marek Szyprowski , Joerg Roedel , Sasha Levin Subject: [PATCH 4.14 129/229] iommu/exynos: Handle failed IOMMU device registration properly Date: Tue, 23 Aug 2022 10:24:50 +0200 Message-Id: <20220823080058.330949128@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sam Protsenko [ Upstream commit fce398d2d02c0a9a2bedf7c7201b123e153e8963 ] If iommu_device_register() fails in exynos_sysmmu_probe(), the previous calls have to be cleaned up. In this case, the iommu_device_sysfs_add() should be cleaned up, by calling its remove counterpart call. Fixes: d2c302b6e8b1 ("iommu/exynos: Make use of iommu_device_register interface") Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski Acked-by: Marek Szyprowski Link: https://lore.kernel.org/r/20220714165550.8884-3-semen.protsenko@linaro.org Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/exynos-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index f4ebef29c644..b1b797fd9d3b 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -638,7 +638,7 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) ret = iommu_device_register(&data->iommu); if (ret) - return ret; + goto err_iommu_register; platform_set_drvdata(pdev, data); @@ -665,6 +665,10 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev) pm_runtime_enable(dev); return 0; + +err_iommu_register: + iommu_device_sysfs_remove(&data->iommu); + return ret; } static int __maybe_unused exynos_sysmmu_suspend(struct device *dev) -- 2.35.1