linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Claudiu Manoil <claudiu.manoil@nxp.com>
To: <linuxppc-dev@lists.ozlabs.org>
Cc: Scott Wood <oss@buserror.net>, <roy.pledge@nxp.com>
Subject: [PATCH 03/17] soc/qman: Fix h/w resource cleanup error path handling
Date: Wed, 16 Nov 2016 16:40:16 +0200	[thread overview]
Message-ID: <1479307230-16650-4-git-send-email-claudiu.manoil@nxp.com> (raw)
In-Reply-To: <1479307230-16650-1-git-send-email-claudiu.manoil@nxp.com>

qman_query_fq*() may return other error codes apart from
-ERANGE, in which cases the error handling done by the
resource cleanup callers would be wrong.  The patch
fixes the handling of those cases, and cleans up related
code inside the resource cleanup & release handlers (i.e.
replace hardcoded fqid value with corresponding define).

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
---
 drivers/soc/fsl/qbman/qman.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c
index 119054b..80ff0b7 100644
--- a/drivers/soc/fsl/qbman/qman.c
+++ b/drivers/soc/fsl/qbman/qman.c
@@ -2789,15 +2789,18 @@ static int qpool_cleanup(u32 qp)
 		struct qm_mcr_queryfq_np np;
 
 		err = qman_query_fq_np(&fq, &np);
-		if (err)
+		if (err == -ERANGE)
 			/* FQID range exceeded, found no problems */
 			return 0;
+		else if (WARN_ON(err))
+			return err;
+
 		if ((np.state & QM_MCR_NP_STATE_MASK) != QM_MCR_NP_STATE_OOS) {
 			struct qm_fqd fqd;
 
 			err = qman_query_fq(&fq, &fqd);
 			if (WARN_ON(err))
-				return 0;
+				return err;
 			if (qm_fqd_get_chan(&fqd) == qp) {
 				/* The channel is the FQ's target, clean it */
 				err = qman_shutdown_fq(fq.fqid);
@@ -2836,7 +2839,7 @@ static int cgr_cleanup(u32 cgrid)
 	 * error, looking for non-OOS FQDs whose CGR is the CGR being released
 	 */
 	struct qman_fq fq = {
-		.fqid = 1
+		.fqid = QM_FQID_RANGE_START
 	};
 	int err;
 
@@ -2844,15 +2847,18 @@ static int cgr_cleanup(u32 cgrid)
 		struct qm_mcr_queryfq_np np;
 
 		err = qman_query_fq_np(&fq, &np);
-		if (err)
+		if (err == -ERANGE)
 			/* FQID range exceeded, found no problems */
 			return 0;
+		else if (WARN_ON(err))
+			return err;
+
 		if ((np.state & QM_MCR_NP_STATE_MASK) != QM_MCR_NP_STATE_OOS) {
 			struct qm_fqd fqd;
 
 			err = qman_query_fq(&fq, &fqd);
 			if (WARN_ON(err))
-				return 0;
+				return err;
 			if ((fqd.fq_ctrl & QM_FQCTRL_CGE) &&
 			    fqd.cgid == cgrid) {
 				pr_err("CRGID 0x%x is being used by FQID 0x%x, CGR will be leaked\n",
-- 
1.7.11.7

  parent reply	other threads:[~2016-11-16 14:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 14:40 [PATCH 00/17] soc/qman: Fixes, endianness handling and related cleanup Claudiu Manoil
2016-11-16 14:40 ` [PATCH 01/17] soc/qman: Check ioremap return value Claudiu Manoil
2016-11-16 14:40 ` [PATCH 02/17] soc/qman: Replace of_get_property() with portable equivalent Claudiu Manoil
2016-11-16 14:40 ` Claudiu Manoil [this message]
2016-11-16 14:40 ` [PATCH 04/17] soc/qbman: Fix resource leak on portal probing error path Claudiu Manoil
2016-11-16 14:40 ` [PATCH 05/17] soc/qman: Fix struct qm_fqd set accessor for context_a Claudiu Manoil
2016-11-16 14:40 ` [PATCH 06/17] soc/qman: Fix direct access to fd's addr_lo, use proper accesor Claudiu Manoil
2016-11-16 14:40 ` [PATCH 07/17] soc/qman: test: Fix implementation of fd_cmp() Claudiu Manoil
2016-11-16 14:40 ` [PATCH 08/17] soc/qman: Don't add a new platform device for dma mapping Claudiu Manoil
2016-11-16 14:40 ` [PATCH 09/17] soc/qman: test: Don't use dummy " Claudiu Manoil
2016-11-16 14:40 ` [PATCH 10/17] soc/qman: Remove redundant checks from qman_create_cgr() Claudiu Manoil
2016-11-16 14:40 ` [PATCH 11/17] soc/qman: Remove unused struct qm_mcc* layouts Claudiu Manoil
2016-11-16 14:40 ` [PATCH 12/17] soc/qman: Fix accesses to fqid, cleanup Claudiu Manoil
2016-11-16 14:40 ` [PATCH 13/17] soc/qman: Drop unused field from eqcr/dqrr descriptors Claudiu Manoil
2016-11-16 14:40 ` [PATCH 14/17] soc/qbman: Handle endianness of qm/bm_in/out() Claudiu Manoil
2016-11-16 14:40 ` [PATCH 15/17] soc/qman: Change remaining contextB into context_b Claudiu Manoil
2016-11-16 14:40 ` [PATCH 16/17] soc/qman: Clean up CGR CSCN target update operations Claudiu Manoil
2016-11-16 14:40 ` [PATCH 17/17] soc/qman: Handle endianness of h/w descriptors Claudiu Manoil

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=1479307230-16650-4-git-send-email-claudiu.manoil@nxp.com \
    --to=claudiu.manoil@nxp.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oss@buserror.net \
    --cc=roy.pledge@nxp.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).