From patchwork Wed Jun 14 20:41:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harshit Mogalapalli X-Patchwork-Id: 13286339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25005C001B3 for ; Tue, 20 Jun 2023 18:29:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7BAE10E38A; Tue, 20 Jun 2023 18:29:24 +0000 (UTC) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 446EC10E16D; Wed, 14 Jun 2023 20:41:47 +0000 (UTC) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35EJtEOa018110; Wed, 14 Jun 2023 20:41:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=PHe5HfxjOkcRnacOoCZlGZI8u+HsglkIVmO3NBIpEb8=; b=Oc/Lq8ZjDXzr+arONZeMk3tXQjhxFPq2/fgtAOPLOJsmKtdo4SFaz/9zfUHcAZVPiXEj nvQaLcwlWg55ZLe/gJLUCncJHmETlq56NkoTo0zInfBabGO3wdVzlqQkqnat4fkfeob9 NCtg1oObbGUe6PgDtVP2+ToXZR7Ib9xsROHwK1uBuEywCgglVhjUR1LhL233H1WAOxCX 0FOHhFOC7jRSuR3CQ2nyVRXCXjsRgjLJs5eiNO6mrt2+FxNsJ1LySNFMIwws/5/8uC9V fjAeiq0v5BcR8HwLBK+2Ee4B9vvTidC0SxeVVRFNXipvJZAA4je+xmQ4Vz27WlRM0qaX Xg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h7d8jeq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 20:41:16 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35EKYLXc008966; Wed, 14 Jun 2023 20:41:15 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm6bquq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 20:41:15 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35EKfEmi021978; Wed, 14 Jun 2023 20:41:14 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3r4fm6bqtm-1; Wed, 14 Jun 2023 20:41:14 +0000 From: Harshit Mogalapalli To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Daniele Ceraolo Spurio , John Harrison , Alan Previn , Harshit Mogalapalli , Michal Wajdeczko , Greg Kroah-Hartman , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Date: Wed, 14 Jun 2023 13:41:06 -0700 Message-ID: <20230614204109.3071989-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_14,2023-06-14_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140181 X-Proofpoint-ORIG-GUID: aW4V0k6qElqU-6NSCbtVSQLe_FsutlCL X-Proofpoint-GUID: aW4V0k6qElqU-6NSCbtVSQLe_FsutlCL X-Mailman-Approved-At: Tue, 20 Jun 2023 18:28:21 +0000 Subject: [Intel-gfx] [PATCH next] drm/i915/huc: Fix missing error code in intel_huc_init() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: error27@gmail.com, dan.carpenter@linaro.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Smatch warns: drivers/gpu/drm/i915/gt/uc/intel_huc.c:388 intel_huc_init() warn: missing error code 'err' When the allocation of VMAs fail: The value of err is zero at this point and it is passed to PTR_ERR and also finally returning zero which is success instead of failure. Fix this by adding the missing error code when VMA allocation fails. Fixes: 08872cb13a71 ("drm/i915/mtl/huc: auth HuC via GSC") Signed-off-by: Harshit Mogalapalli --- Found using Static analysis with Smatch, only compile tested. --- drivers/gpu/drm/i915/gt/uc/intel_huc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c index e0afd8f89502..ddd146265beb 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c @@ -384,6 +384,7 @@ int intel_huc_init(struct intel_huc *huc) vma = intel_guc_allocate_vma(>->uc.guc, PXP43_HUC_AUTH_INOUT_SIZE * 2); if (IS_ERR(vma)) { + err = PTR_ERR(vma); huc_info(huc, "Failed to allocate heci pkt\n"); goto out; }