From patchwork Fri Jan 24 09:29:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 232962 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 2BB77C35242 for ; Fri, 24 Jan 2020 11:21:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E315324125 for ; Fri, 24 Jan 2020 11:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864906; bh=WOMNstggyX/KswWup2Z6hidzCZO+c+6tvms/yHazb78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WD6+B6A9OhJ5+M69lFsT4mDGbr6qlMRfSykJznqbIdWim1EuqmuHGN0wFFGZjlV70 Kd1TjAwk9rDf+j+X/DbTNeLd+cVkvWQBnszZiYE2qSKuEvfWumgrfVrqLiRFXuitEJ Sf24bN+SSAwPpHCxS3JabzuNliYc6sgz2xhQuyXg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391106AbgAXLVp (ORCPT ); Fri, 24 Jan 2020 06:21:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:60312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390482AbgAXLVm (ORCPT ); Fri, 24 Jan 2020 06:21:42 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (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 C6F5E206D4; Fri, 24 Jan 2020 11:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864902; bh=WOMNstggyX/KswWup2Z6hidzCZO+c+6tvms/yHazb78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j9Rn8FxYUMRdTczNG7REh82tgZlgwhS6amLsOmWffj2MW8nQ7i8ZLbe0mhhwlLMoc H4BENeYFMb98pRdKBV1BnSkgdy/0dvvZgJmoZq4KC//BBV65aB8QB7Gpf/Wy7FTtYj Gnnv/UR6t7LYDKg/uZo8MUb6Ck8u3cOFU5FzGeDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lu Baolu , Joerg Roedel , Sasha Levin Subject: [PATCH 4.19 397/639] iommu: Use right function to get group for device Date: Fri, 24 Jan 2020 10:29:27 +0100 Message-Id: <20200124093136.656149999@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lu Baolu [ Upstream commit 57274ea25736496ee019a5c40479855b21888839 ] The iommu_group_get_for_dev() will allocate a group for a device if it isn't in any group. This isn't the use case in iommu_request_dm_for_dev(). Let's use iommu_group_get() instead. Fixes: d290f1e70d85a ("iommu: Introduce iommu_request_dm_for_dev()") Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index b82bec4224b91..00e1c908cd8e7 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1900,9 +1900,9 @@ int iommu_request_dm_for_dev(struct device *dev) int ret; /* Device must already be in a group before calling this function */ - group = iommu_group_get_for_dev(dev); - if (IS_ERR(group)) - return PTR_ERR(group); + group = iommu_group_get(dev); + if (!group) + return -EINVAL; mutex_lock(&group->mutex);