From patchwork Fri Mar 17 07:25:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harshit Mogalapalli X-Patchwork-Id: 71115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp197944wrt; Fri, 17 Mar 2023 00:36:23 -0700 (PDT) X-Google-Smtp-Source: AK7set+DjZlVvggXDQAqZ9bnP5XprOW+2N2ivtF7PPpQRhK2YwkOBAtnVa9tIg1ctvehR0NWj/1c X-Received: by 2002:a05:6a21:32a2:b0:d5:ac2b:7dfa with SMTP id yt34-20020a056a2132a200b000d5ac2b7dfamr11370450pzb.1.1679038582994; Fri, 17 Mar 2023 00:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679038582; cv=none; d=google.com; s=arc-20160816; b=je/hyB9AKOHezD6ecjocAaNjvGN8CkgeaQk6wIohRyjunK0FkWvRKu8EAZ9MuB3XNM BqiLJ3bjejwGde4vl+L1Sw0Ajn3/L2nUoZYN3AXpm4ZRJmEsn0GLaspJYvN+2mCfv6G7 +SlzdZuafqw6DqsMjzTEngqsko1N0v6VGSIDb80a1tQUlDNAcpWrfBuoqWA6+rtI0u+S w8/T4cNL+ONJ/6Tg4tbKKB9K/tXShmU0mKiWSvLQRHj7UnYME5+dfzP+hM1L5sqdDeFP QOq6ZHnN7QH/B/pXCLBth4/JgcS9MC3adaRzu8acm8JE/HZq9T/iEuHviXR6r8JUHLyS ubFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=wZD+pUOh1BgwEErZt87GvEPFPQJSCLghwUussCiTRtk=; b=HMYiM6pyD+EAnGzSIqQcB0e/bxa9JAvh813nzdvYGypBXhMo12aoZ+q9t38bDmvKjP GCZr0PKRrldVxy5Ptp3fSt7T05pFJDMA05WtnyYlKK31Om9kQ2QIsAyiyXeY0thmqpCA msxfDxFBgzSDa3TKn8qej/QYvAkYeZpbcpOK6dra9TCo7LPc8NiZMgKb4/Ix0NJGLxwY 5u+ZwefG/uHLJb8aULr+fbyG/FYe1LFkpOvRsF5NMjeyqPqFx3BaGH6Uf2H/TESw2hMk 5EfsQ/MOpWYps/jc9OGBsBLDxltbQd05EByKe4Q/8LtDoT8Ky7Su3TbGggRTPcApdS78 MFSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@oracle.com header.s=corp-2022-7-12 header.b=FPbNdQSp; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br8-20020a17090b0f0800b0022c5a147e9fsi1504515pjb.115.2023.03.17.00.36.08; Fri, 17 Mar 2023 00:36:22 -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=fail header.i=@oracle.com header.s=corp-2022-7-12 header.b=FPbNdQSp; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbjCQH0Q (ORCPT + 99 others); Fri, 17 Mar 2023 03:26:16 -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 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 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1760599561174334552?= X-GMAIL-MSGID: =?utf-8?q?1760599561174334552?= 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);