From patchwork Sun May 29 15:34:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 577175 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 B94C4C433F5 for ; Sun, 29 May 2022 15:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbiE2PjM (ORCPT ); Sun, 29 May 2022 11:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbiE2PjM (ORCPT ); Sun, 29 May 2022 11:39:12 -0400 Received: from sender2-op-o12.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47AF62CF4; Sun, 29 May 2022 08:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1653838737; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=b9EOAZEtMeMOw4CE+ljgRiq8Y/E5wl6YtfwQ/Y/g9fY=; b=K9iFG7haZUnGl1ACKH9GvvKesKECfbzX0cWBpwodvG6BRLJaHls0JImr3+HAEmHm +uXvCiCjRePe+nObZGZ1d8VfQOOPYWwOdhdmUaZpfa4neNxZWqzjfP1RRtS6NR27ONk ReifQ7gUfj5xi9TRzz/Qulfxi6GMfkwK0JwzVfaI= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 1653838735065952.2650944013579; Sun, 29 May 2022 23:38:55 +0800 (CST) From: Chengguang Xu To: netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Cc: Chengguang Xu Message-ID: <20220529153456.4183738-2-cgxu519@mykernel.net> Subject: [PATCH 1/6] netlink: fix missing destruction of rhash table in error case Date: Sun, 29 May 2022 23:34:51 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220529153456.4183738-1-cgxu519@mykernel.net> References: <20220529153456.4183738-1-cgxu519@mykernel.net> MIME-Version: 1.0 X-ZohoCNMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Fix missing destruction(when '(--i) == 0') for error case in netlink_proto_init(). Signed-off-by: Chengguang Xu --- net/netlink/af_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 0cd91f813a3b..bd0b090a378b 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2887,7 +2887,7 @@ static int __init netlink_proto_init(void) for (i = 0; i < MAX_LINKS; i++) { if (rhashtable_init(&nl_table[i].hash, &netlink_rhashtable_params) < 0) { - while (--i > 0) + while (--i >= 0) rhashtable_destroy(&nl_table[i].hash); kfree(nl_table); goto panic; From patchwork Sun May 29 15:34:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 577174 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 000BEC433EF for ; Sun, 29 May 2022 15:39:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231189AbiE2PjN (ORCPT ); Sun, 29 May 2022 11:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbiE2PjM (ORCPT ); Sun, 29 May 2022 11:39:12 -0400 Received: from sender2-op-o12.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A3062CF6; Sun, 29 May 2022 08:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1653838739; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=flOcGigG3FIhki9qeUJuXud/Jj5FC8Aqn+kS5ocOzLs=; b=X4RH1B7ofe8dHWlERs3xxOmDu+/sW1EEAwStAQN53r5SnJGMtxh74ympVLOMKv7x oI3VWb6X/J6NMTl41V372KRFn/38NmGBUjwh+MpbpqtE8NfXMcWHVi91nfkec/3uyE3 TQjOh4CwX4n/YR7fYiL0tK5cRdY5vno4I9xvVe18= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 1653838736850922.0717547158011; Sun, 29 May 2022 23:38:56 +0800 (CST) From: Chengguang Xu To: netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Cc: Chengguang Xu Message-ID: <20220529153456.4183738-3-cgxu519@mykernel.net> Subject: [PATCH 2/6] staging: vt6655: fix missing resource cleanup in error cases Date: Sun, 29 May 2022 23:34:52 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220529153456.4183738-1-cgxu519@mykernel.net> References: <20220529153456.4183738-1-cgxu519@mykernel.net> MIME-Version: 1.0 X-ZohoCNMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Fix missing resource cleanup(when '(--i) == 0') for error cases Signed-off-by: Chengguang Xu --- drivers/staging/vt6655/device_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 897d70cf32b8..cf8d92e785e6 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -565,7 +565,7 @@ static int device_init_rd0_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (--i >= 0) { desc = &priv->aRD0Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -611,7 +611,7 @@ static int device_init_rd1_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (--i >= 0) { desc = &priv->aRD1Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -676,7 +676,7 @@ static int device_init_td0_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (--i >= 0) { desc = &priv->apTD0Rings[i]; kfree(desc->td_info); } @@ -716,7 +716,7 @@ static int device_init_td1_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (--i >= 0) { desc = &priv->apTD1Rings[i]; kfree(desc->td_info); } From patchwork Sun May 29 15:34:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 577680 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 74A14C4167B for ; Sun, 29 May 2022 15:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231223AbiE2PjV (ORCPT ); Sun, 29 May 2022 11:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbiE2PjP (ORCPT ); Sun, 29 May 2022 11:39:15 -0400 Received: from sender2-op-o12.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322E762CF6; Sun, 29 May 2022 08:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1653838740; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=GrTj8VY0/9DV3DlXEyfob5/+KcrPMGhSzDeS9OqV1Rc=; b=KGQHbauPudSMl2lfmpKHoOrKXT5ELfnxaEoVuot7m7M2b+maCHgpjqVUUfNjt5aR 1AWYi9QYshVs2M5BIYCVwsT5+8my7EV2seYd1hJctPVjWZHShlVFBSWsz8f7j8ZjplX b6dFaLAhptGAeSKjuYgcQ7xf7eg28t8INm4FIGUQ= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 1653838738366295.3214211822982; Sun, 29 May 2022 23:38:58 +0800 (CST) From: Chengguang Xu To: netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Cc: Chengguang Xu Message-ID: <20220529153456.4183738-4-cgxu519@mykernel.net> Subject: [PATCH 3/6] scsi: ipr: fix missing/incorrect resource cleanup in error case Date: Sun, 29 May 2022 23:34:53 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220529153456.4183738-1-cgxu519@mykernel.net> References: <20220529153456.4183738-1-cgxu519@mykernel.net> MIME-Version: 1.0 X-ZohoCNMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Fix missing resource cleanup(when '(--i) == 0') for error case in ipr_alloc_mem() and skip incorrect resource cleanup(when '(--i) == 0') for error case in ipr_request_other_msi_irqs() because variable i started from 1. Signed-off-by: Chengguang Xu Acked-by: Brian King --- drivers/scsi/ipr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 256ec6d08c16..9d01a3e3c26a 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -9795,7 +9795,7 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) GFP_KERNEL); if (!ioa_cfg->hrrq[i].host_rrq) { - while (--i > 0) + while (--i >= 0) dma_free_coherent(&pdev->dev, sizeof(u32) * ioa_cfg->hrrq[i].size, ioa_cfg->hrrq[i].host_rrq, @@ -10068,7 +10068,7 @@ static int ipr_request_other_msi_irqs(struct ipr_ioa_cfg *ioa_cfg, ioa_cfg->vectors_info[i].desc, &ioa_cfg->hrrq[i]); if (rc) { - while (--i >= 0) + while (--i > 0) free_irq(pci_irq_vector(pdev, i), &ioa_cfg->hrrq[i]); return rc; From patchwork Sun May 29 15:34:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 577173 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 411A2C433EF for ; Sun, 29 May 2022 15:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbiE2PjU (ORCPT ); Sun, 29 May 2022 11:39:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231154AbiE2PjP (ORCPT ); Sun, 29 May 2022 11:39:15 -0400 Received: from sender2-op-o12.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4C5762CF4; Sun, 29 May 2022 08:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1653838741; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=daX12GWew3IwCy2KNmUXjEytC9BpO3UdZ4OA9NkkNJQ=; b=VkNQu0/8lYhufkUBrHbwvdLG1P4OU7QAocD+n+MvS9sCVDVAuHtVUDl0e+JILLhQ 3khGf4mMAU9jpkWQhePNdXUyU0f0XQz7RJoSWaZvOHoost6JFTXR8x8pI4zWfLvWy09 2c88LvaRZAvqQCA0KziiAk1HDoWXNzSmrGai4Wp0= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 1653838739745377.08340585932433; Sun, 29 May 2022 23:38:59 +0800 (CST) From: Chengguang Xu To: netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Cc: Chengguang Xu Message-ID: <20220529153456.4183738-5-cgxu519@mykernel.net> Subject: [PATCH 4/6] drm/exynos: fix missing resource cleanup in error case Date: Sun, 29 May 2022 23:34:54 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220529153456.4183738-1-cgxu519@mykernel.net> References: <20220529153456.4183738-1-cgxu519@mykernel.net> MIME-Version: 1.0 X-ZohoCNMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Fix missing resource cleanup(when '(--i) == 0') for error case in gsc_runtime_resume(). Signed-off-by: Chengguang Xu --- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 964dceb28c1e..68ea92742b06 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -1342,7 +1342,7 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev) for (i = 0; i < ctx->num_clocks; i++) { ret = clk_prepare_enable(ctx->clocks[i]); if (ret) { - while (--i > 0) + while (--i >= 0) clk_disable_unprepare(ctx->clocks[i]); return ret; } From patchwork Sun May 29 15:34:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 577172 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 86BBAC4332F for ; Sun, 29 May 2022 15:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbiE2Pj0 (ORCPT ); Sun, 29 May 2022 11:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbiE2PjS (ORCPT ); Sun, 29 May 2022 11:39:18 -0400 Received: from sender2-op-o12.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E43C62CFF; Sun, 29 May 2022 08:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1653838743; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=X/Nq01tIJiL66k1gHdv7dx/ePbQHb3DUAurLiy4DtgY=; b=Fxu+1huBl4/KM9ltkTR62MbYdabZL04hTFCByM3kfUr9KQF+biVFQn04SW5kP1Q1 d5FpcnH+HjpXz3YGGZs8hNGV7vmMhcINJN8I3dyyTu3u5GPC3BA13oZEbKWyod0tHYM x4zAoZp93gXnnqBdI3yIffL8VH3rnYxVVye1HRYM= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 1653838741319791.7650617890589; Sun, 29 May 2022 23:39:01 +0800 (CST) From: Chengguang Xu To: netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Cc: Chengguang Xu Message-ID: <20220529153456.4183738-6-cgxu519@mykernel.net> Subject: [PATCH 5/6] scsi: pmcraid: fix missing resource cleanup in error case Date: Sun, 29 May 2022 23:34:55 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220529153456.4183738-1-cgxu519@mykernel.net> References: <20220529153456.4183738-1-cgxu519@mykernel.net> MIME-Version: 1.0 X-ZohoCNMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Fix missing resource cleanup(when '(--i) == 0') for error case in pmcraid_register_interrupt_handler(). Signed-off-by: Chengguang Xu --- drivers/scsi/pmcraid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 3d5cd337a2a6..0007a8a993a1 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -4031,7 +4031,7 @@ pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance) return 0; out_unwind: - while (--i > 0) + while (--i >= 0) free_irq(pci_irq_vector(pdev, i), &pinstance->hrrq_vector[i]); pci_free_irq_vectors(pdev); return rc; From patchwork Sun May 29 15:34:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 577681 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 D9D91C4332F for ; Sun, 29 May 2022 15:39:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229822AbiE2PjT (ORCPT ); Sun, 29 May 2022 11:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231196AbiE2PjO (ORCPT ); Sun, 29 May 2022 11:39:14 -0400 Received: from sender2-op-o12.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 358DC62CF2; Sun, 29 May 2022 08:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1653838744; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:From:To:To:Cc:Cc:Message-ID:Subject:Subject:Date:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=xGbv7HlqU9NUiVmKFFfWHWJ7GjiXkmgNU5UawXCQxn8=; b=CEiWwOtlT6bd2aVw4bG73jCv97mRPVBdqfemmSl/LrQoOQJuysu1DOyLp9C6hlcb l2D8QE9ga+kYz/ATTtLgF0EOURGdgn332FlVJoPf6/C9LyQkbp8oe5lGo+4xeIauouw 7C7pRqm4BnKd9PBU8/vgPBg4yEo7o44a99YUBhJg= Received: from localhost.localdomain (81.71.33.115 [81.71.33.115]) by mx.zoho.com.cn with SMTPS id 1653838743051746.6363796456236; Sun, 29 May 2022 23:39:03 +0800 (CST) From: Chengguang Xu To: netdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org Cc: Chengguang Xu Message-ID: <20220529153456.4183738-7-cgxu519@mykernel.net> Subject: [PATCH 6/6] media: platform: fix missing/incorrect resource cleanup in error case Date: Sun, 29 May 2022 23:34:56 +0800 X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220529153456.4183738-1-cgxu519@mykernel.net> References: <20220529153456.4183738-1-cgxu519@mykernel.net> MIME-Version: 1.0 X-ZohoCNMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org In error case of s5p_mfc_power_on() we should call clk_disable_unprepare() for the clocks(from pm->clocks[0] to pm->clocks[i-1]). Signed-off-by: Chengguang Xu --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c index 72a901e99450..187849841a28 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_pm.c @@ -88,7 +88,6 @@ int s5p_mfc_power_on(void) if (ret < 0) { mfc_err("clock prepare failed for clock: %s\n", pm->clk_names[i]); - i++; goto err; } } @@ -98,7 +97,7 @@ int s5p_mfc_power_on(void) return 0; err: - while (--i > 0) + while (--i >= 0) clk_disable_unprepare(pm->clocks[i]); pm_runtime_put(pm->device); return ret;