From patchwork Mon Oct 5 15:26:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58341C46466 for ; Mon, 5 Oct 2020 15:27:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2200020E65 for ; Mon, 5 Oct 2020 15:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601911679; bh=Ukh+MnMNTKbLU4flqoVA3Pcv2bOWuPnI167LKCiCxnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=c9CkNay58M1Fl0btUfSVDKyWshWXzFF7OR2sQui0KRjeJhKU0VQiMugOfZv1vV4cr XVMhTRorUzTLei/UA6SA4zc3eHsSZwMivVxWlxVaF/EwtoDQ2RhMsx2FnKGzNK9V3X 5+iqgbi3pt7QJqCezlBeQyxSCxiWoGen/NZsT19I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbgJEP1x (ORCPT ); Mon, 5 Oct 2020 11:27:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:52296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbgJEP1j (ORCPT ); Mon, 5 Oct 2020 11:27:39 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9168C2085B; Mon, 5 Oct 2020 15:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601911659; bh=Ukh+MnMNTKbLU4flqoVA3Pcv2bOWuPnI167LKCiCxnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ETdKxeBMj/NzLJUYgGWybNq9gy0fHsW7xN854H+0uSS7g8hFZhXbbq/IPbxc3NUz hv1oz6Z9rB3gsNi3rUzAXfkUQUOAVNGwv8+U3KFKulKo7FJYmSZNBFzicBV6FvB8gf HvD71LxN2/x85Q8pO+wZzKRFqa56fBKuSeQM3l4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Marek Szyprowski , Joerg Roedel , Sasha Levin Subject: [PATCH 4.19 27/38] iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate() Date: Mon, 5 Oct 2020 17:26:44 +0200 Message-Id: <20201005142109.977461657@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005142108.650363140@linuxfoundation.org> References: <20201005142108.650363140@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yu Kuai [ Upstream commit 1a26044954a6d1f4d375d5e62392446af663be7a ] if of_find_device_by_node() succeed, exynos_iommu_of_xlate() doesn't have a corresponding put_device(). Thus add put_device() to fix the exception handling for this function implementation. Fixes: aa759fd376fb ("iommu/exynos: Add callback for initializing devices from device tree") Signed-off-by: Yu Kuai Acked-by: Marek Szyprowski Link: https://lore.kernel.org/r/20200918011335.909141-1-yukuai3@huawei.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/exynos-iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 1bd0cd7168dfc..4bf6049dd2c79 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1302,13 +1302,17 @@ static int exynos_iommu_of_xlate(struct device *dev, return -ENODEV; data = platform_get_drvdata(sysmmu); - if (!data) + if (!data) { + put_device(&sysmmu->dev); return -ENODEV; + } if (!owner) { owner = kzalloc(sizeof(*owner), GFP_KERNEL); - if (!owner) + if (!owner) { + put_device(&sysmmu->dev); return -ENOMEM; + } INIT_LIST_HEAD(&owner->controllers); mutex_init(&owner->rpm_lock);