Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2885293rwb; Mon, 15 Aug 2022 13:17:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR6x9Y5Q87ST0YQSV0/ah9Q1RrEFlySV9vU9xhuhy62ONAuQ8TwrnnCKpOqHfeVSz6QKHeFX X-Received: by 2002:a17:907:271b:b0:730:aa8e:74eb with SMTP id w27-20020a170907271b00b00730aa8e74ebmr11539489ejk.478.1660594674199; Mon, 15 Aug 2022 13:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594674; cv=none; d=google.com; s=arc-20160816; b=pRzillL6ECI6W1faNrvgsoTDYbAgGr5Wbi42GxCPxP4gqH+3FizuUUPFf0gX6ogb1u q2rK60Jpg2ITshCKClzlCUt2D4IiKAxPMDk9ZCmqrNdPAfMeGelaaK3IkkmQ47N3YZuM 9TUW/0GPkhunSpuOtkDPlJ+PxSn5/g0yPBSGzF38hQTXw0OD6eHWvEG+V5eXyOw2GOAF OP+3q0PrQ0fLoAvhYXAq3uj74f7xoSvxlLt3m94pxpiuTi+BodxyyREybSBbul8FTSgW 1RUrAa4YOn9xDuqHKTpVKO9lxpduCljDJFSd722sM1zFrsZTlyQkgtHcK4adcSkeNgB3 j6dQ== 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=26WkN7tets40c1UmiZDc6LifZYoCqXtrONUquJu4Cug=; b=InZwldlFuTZUFVy9wK5p/Zvy24EgLH33PPLA2DKzdTokyYI3N/pNnPiOxWSi4I1TYo 2uG6kiPAyeXgvYQFM164yj7+XqjFpsXkxrkT22JO0LffH5PxsDDh55Lnr5ueekQp+kJt SaQSr9P9fIgCmJNSKZkcsC+tbfqsTPKWxlgHd14rDi3ByAwh9o1pqgJCxnxgOYZjt2V3 aqIpYWyuez7lP03+i4iRNb6J5PLzNJH33VDyx2QC2728cTejb3W5x6HTgf3R88KLF+nm qYP6gLGO1sko1A24r6CIztekKz77vF2MCp4Du/0Em/l21ZGP9Jnbqh4L87de8C3n5eE3 qo/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dWMQ8LXy; 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 n3-20020a17090695c300b0072eece129bdsi7436314ejy.59.2022.08.15.13.17.26; Mon, 15 Aug 2022 13:17:54 -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=dWMQ8LXy; 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 S1344490AbiHOTgo (ORCPT + 99 others); Mon, 15 Aug 2022 15:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344191AbiHOTbL (ORCPT ); Mon, 15 Aug 2022 15:31:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F21D60517; Mon, 15 Aug 2022 11:44:28 -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 56E8D611C1; Mon, 15 Aug 2022 18:44:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5012CC433D7; Mon, 15 Aug 2022 18:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589066; bh=+TbaaYbSBoBGvAluhcP3Z4EiFOsKfK4408pvK7toNQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dWMQ8LXy6Nd0Me17NHyvlX/Ci+K+00GOQTwWjKhy7hnXSbINQ4PHB2OORXT1XFFMM U+/5HcWZerAwyDNG+UkWjCovMmG4tjATA8DfnITcoJSUCmMKF0Nhq/6FnfrPxCfuOW k3JSJ86sIpnD7WhUwmPU36vg/dxBF6ed8aPIE2BI= 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 5.15 603/779] iommu/exynos: Handle failed IOMMU device registration properly Date: Mon, 15 Aug 2022 20:04:07 +0200 Message-Id: <20220815180403.132641736@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 939ffa768986..f96acc3525e8 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -630,7 +630,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) ret = iommu_device_register(&data->iommu, &exynos_iommu_ops, dev); if (ret) - return ret; + goto err_iommu_register; platform_set_drvdata(pdev, data); @@ -657,6 +657,10 @@ static int 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