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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7A9AC6FD1D for ; Fri, 17 Mar 2023 07:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjCQH0R (ORCPT ); Fri, 17 Mar 2023 03:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbjCQH0L (ORCPT ); Fri, 17 Mar 2023 03:26:11 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1065769051 for ; Fri, 17 Mar 2023 00:25:46 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32H4smuw028829; Fri, 17 Mar 2023 07:25:20 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-2022-7-12; bh=wZD+pUOh1BgwEErZt87GvEPFPQJSCLghwUussCiTRtk=; b=FPbNdQSpS/lVlDdK1CaZ5tvBuppVzAYx+nAGGUaercijzOUpW4tUyFwBVtzK1qjdE0UN wtIAhriDJ7wgr80NwDmE2lnK9bTHgJtdvEPVlnOgd5dTe5yi+mXfoNxtrCQuySTjDkXv tlut17U9V+NcscRN6CjtIyAEUC+F5fdcW7iJv0/4dj9al/TlUVpWUuQg9NZfTC7RcOF0 cPxiH96tY7YPzJ0Rsb0ezJXYK/JT+vR1viBxxvQpivSdUzAUT/FQftVj3E9JrU1+Xzil UwIGa9q2QPVwMDZqoD095fiU273Bi4F5OZhFjxIfR8q2v4X43KcWleTcaGRKLid9BWu8 7w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pbs29k73v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Mar 2023 07:25:20 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32H7D3qU036944; Fri, 17 Mar 2023 07:25:19 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3pbq9jn53j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Mar 2023 07:25:19 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32H7PIHi037919; Fri, 17 Mar 2023 07:25:18 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3pbq9jn538-1; Fri, 17 Mar 2023 07:25:18 +0000 From: Harshit Mogalapalli Cc: error27@gmail.com, Harshit Mogalapalli , Joerg Roedel , Will Deacon , Robin Murphy , Heiko Stuebner , Marc Zyngier , Olof Johansson , iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] iommu: rockchip: Fix missing unwind goto in rk_iommu_probe() Date: Fri, 17 Mar 2023 00:25:15 -0700 Message-Id: <20230317072515.2924468-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-17_04,2023-03-16_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303170048 X-Proofpoint-ORIG-GUID: lDSTuoJHxbUjUIk9TCVHlD7iwVYSBvf6 X-Proofpoint-GUID: lDSTuoJHxbUjUIk9TCVHlD7iwVYSBvf6 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Smatch reports: drivers/iommu/rockchip-iommu.c:1306 rk_iommu_probe() warn: missing unwind goto? Smatch detects that when (irq < 0) we are directly returning without doing the cleanup. Fix this by adding a pm_runtime_disable(dev), and using correct goto label 'err_remove_sysfs' instead of a direct return. Fixes: 1aa55ca9b14a ("iommu/rockchip: Move irq request past pm_runtime_enable") Signed-off-by: Harshit Mogalapalli --- This is purely based on static analysis. Only compile tested. --- drivers/iommu/rockchip-iommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index f30db22ea5d7..0751f2e757fd 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1302,8 +1302,11 @@ static int rk_iommu_probe(struct platform_device *pdev) for (i = 0; i < iommu->num_irq; i++) { int irq = platform_get_irq(pdev, i); - if (irq < 0) - return irq; + if (irq < 0) { + pm_runtime_disable(dev); + err = irq; + goto err_remove_sysfs; + } err = devm_request_irq(iommu->dev, irq, rk_iommu_irq, IRQF_SHARED, dev_name(dev), iommu); -- 2.38.1