All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chengguang Xu <cgxu519@mykernel.net>
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 <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	[thread overview]
Message-ID: <20220529153456.4183738-4-cgxu519@mykernel.net> (raw)
In-Reply-To: <20220529153456.4183738-1-cgxu519@mykernel.net>

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 <cgxu519@mykernel.net>
---
 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;
-- 
2.27.0



  parent reply	other threads:[~2022-05-29 15:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-29 15:34 [PATCH 0/6] fix a common error of while loop condition in error path Chengguang Xu
2022-05-29 15:34 ` [PATCH 1/6] netlink: fix missing destruction of rhash table in error case Chengguang Xu
2022-05-31  8:43   ` Paolo Abeni
2022-05-31 11:25     ` Dan Carpenter
2022-06-01  7:47       ` Chengguang Xu
2022-05-29 15:34 ` [PATCH 2/6] staging: vt6655: fix missing resource cleanup in error cases Chengguang Xu
2022-05-29 15:34 ` Chengguang Xu [this message]
2022-06-01 12:59   ` [PATCH 3/6] scsi: ipr: fix missing/incorrect resource cleanup in error case Brian King
2022-05-29 15:34 ` [PATCH 4/6] drm/exynos: fix missing " Chengguang Xu
2022-05-29 15:34 ` [PATCH 5/6] scsi: pmcraid: " Chengguang Xu
2022-05-29 15:34 ` [PATCH 6/6] media: platform: fix missing/incorrect " Chengguang Xu
2022-05-30  8:20 ` [PATCH 0/6] fix a common error of while loop condition in error path Dan Carpenter
2022-06-08  2:27 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220529153456.4183738-4-cgxu519@mykernel.net \
    --to=cgxu519@mykernel.net \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH 3/6] scsi: ipr: fix missing/incorrect resource cleanup in error case' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.