From patchwork Tue May 30 09:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yanfei Xu X-Patchwork-Id: 100699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2053071vqr; Tue, 30 May 2023 02:39:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WaN1baZCDgzVYlOefZVi1sdf/0VAu4h3NIZlclfBBG3IiZPMJLTvlQQGAanoYfSXGCL1j X-Received: by 2002:a17:902:724c:b0:1a5:150f:8558 with SMTP id c12-20020a170902724c00b001a5150f8558mr1561920pll.17.1685439595047; Tue, 30 May 2023 02:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685439595; cv=none; d=google.com; s=arc-20160816; b=c29aQIustWKIgBQV6m5P5MsucgNgXJUwj3kch8P2r9PuYEms15zwDjfX4mUqBFxA8b vlDSE+JBNUJDesvFioh3Pah+fRM9p6sdzP1ZIAok7PQg0WL8oGuso+IjNCTsD2zuMYkl hrEFaCT7X5nh7JFi+yqoPvrBMUoZL+es72KVc0GEU7kc+iCY25tGxHY8q7ZbAgSJoBe8 OGa0Sj3cAePpFDWgxEyQAExmCV/ycxi+STnjzYgdVIet3rmTXr2RKP19oAzN4DLv2HSJ OGdf6sXCeQv4mJoIY5Godjfzj7dcdBIOSxUR7XlCjyHGhPMsKa+1XpQR+kf8J7VU+12D sn9w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tcvNz8xK9WvUKZ24DYxNfoAXw/+CoS550f21MyOdqdk=; b=fzjjVKRyOQBhnfblSDsrUIA8Ky2AlyaU95ngi+8tgBZy5VA72AhSNGLRu9R4l+4p9l vI45kBSMDfGHWj0WJ6bmnc7hYftWEMUZpzS0YWV4/uPS/PlYE98+JWLu0GoJhJMNEbbM UdiPSyZE/87bgXcOPInOwwM9yfdvnDgYCNRfibGXfdwXMWwSDgGBhd6yQpUm3zKtFWmj 0sb2f/j0tYP5JypiYQZuNc6eEh4KOVou7v5etB1x+dYDxb4KTGqJor8M3oWbNapGGZkZ zhkijz/OwA1rJD/22B4OleCGU981wRTLlQGGi+rhOdpydom9xpdEJh2COzRVV+jooesS Ta/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mCk0zoPA; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a170902704600b001ac8daed841si1405350plt.646.2023.05.30.02.39.43; Tue, 30 May 2023 02:39:55 -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=@intel.com header.s=Intel header.b=mCk0zoPA; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbjE3J2z (ORCPT + 99 others); Tue, 30 May 2023 05:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbjE3J2W (ORCPT ); Tue, 30 May 2023 05:28:22 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94E9FE4E for ; Tue, 30 May 2023 02:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685438867; x=1716974867; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fwx6XkwajTMSuzKO6uWLg7Ou7DkXom2s4s3Qa8sVvZ4=; b=mCk0zoPAfXEfuYY2lbxyF8C11muBH69vVv3bnw9d83YkEbd+whM2NB4L CE8gZuF+bl2J5ehu41vo8shVUdbuJLfuTL0/FsKQ2LOvOOTi4atiD97MH bIOFxX6CVZ9mT3oTTGBMnxsZdY1Xpi8jKTckzCIR45HufuajN4O1befdD 9EHskiTgYBrV5YowHzyhPkfhzv2TJ12fPwB/IXQJxpIW4o1Ay0jst5wwZ WxQbR3Qll2bFiHpehsaBOYzsigIdS+re23SF0KGSvsjsf0fxkv8Zk229K AX6znjsJ+yvK4pyG1iyky3ymo4MDd2IEVjyjG1Cem6DzLW1uI9FrBP+dI A==; X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="344365164" X-IronPort-AV: E=Sophos;i="6.00,203,1681196400"; d="scan'208";a="344365164" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 02:27:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="818720160" X-IronPort-AV: E=Sophos;i="6.00,203,1681196400"; d="scan'208";a="818720160" Received: from tower.bj.intel.com ([10.238.157.62]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 02:27:44 -0700 From: Yanfei Xu To: dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, yanfei.xu@intel.com Subject: [PATCH 1/2] iommu/vt-d: Remove the dead code in init_iommu_hw() Date: Tue, 30 May 2023 17:25:02 +0800 Message-Id: <20230530092503.152926-2-yanfei.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530092503.152926-1-yanfei.xu@intel.com> References: <20230530092503.152926-1-yanfei.xu@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767311509213406040?= X-GMAIL-MSGID: =?utf-8?q?1767311509213406040?= After 'commit 2a41ccee2fdc ("iommu/vt-d: Change iommu_enable/disable_translation to return void")', init_iommu_hw() only returns 0. If statement for return value of this function is meaningless. Hence change init_iommu_hw() to return viod and remove the dead code of if statement in init_iommu_hw() Signed-off-by: Yanfei Xu --- drivers/iommu/intel/iommu.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 8096273b034c..e98f1b122b49 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2963,7 +2963,7 @@ static void __init init_no_remapping_devices(void) } #ifdef CONFIG_SUSPEND -static int init_iommu_hw(void) +static void init_iommu_hw(void) { struct dmar_drhd_unit *drhd; struct intel_iommu *iommu = NULL; @@ -2988,8 +2988,6 @@ static int init_iommu_hw(void) iommu_enable_translation(iommu); iommu_disable_protect_mem_regions(iommu); } - - return 0; } static void iommu_flush_all(void) @@ -3051,13 +3049,7 @@ static void iommu_resume(void) struct intel_iommu *iommu = NULL; unsigned long flag; - if (init_iommu_hw()) { - if (force_on) - panic("tboot: IOMMU setup failed, DMAR can not resume!\n"); - else - WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); - return; - } + init_iommu_hw(); for_each_active_iommu(iommu, drhd) {