All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Nicholas Krause <xerofoify@gmail.com>, ulf.hansson@linaro.org
Cc: tomas.winkler@intel.com, tklauser@distanz.ch, sholi@nvidia.com,
	kuninori.morimoto.gx@renesas.com, lporzio@micron.com,
	chuanxiao.dong@intel.com, jonathanh@nvidia.com,
	grundler@chromium.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] mmc:Fix error handling in the function mmc_blk_issue_rq
Date: Mon, 28 Dec 2015 10:42:33 +0200	[thread overview]
Message-ID: <5680F5F9.9020207@intel.com> (raw)
In-Reply-To: <1451160642-26585-1-git-send-email-xerofoify@gmail.com>

On 26/12/15 22:10, Nicholas Krause wrote:
> This fixes error handling in the function mmc_blk_issue_rq for
> checking if the calls to the function mmc_blk_issue_rw_rq have
> failed by returning zero as there return value and if so jump
> immediately to the goto label out for cleanup of resources used
> and allocated by the function mmc_blk_issue_rq before returning
> this return value to the caller of this particular function to
> indicate to the caller that it's call(s) have failed.

Are you experiencing a problem with the existing code, because it looks more
correct to me?

There does seem to be a gap in the way MMC_QUEUE_NEW_REQUEST is handled,
since the code is expecting that mmc_blk_issue_rw_rq() will have done
waiting for any ongoing request, but it is not clear it will have if
MMC_QUEUE_NEW_REQUEST is possible.  But that is a different issue.

> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/mmc/card/block.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index a1b820f..354a151 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -2055,7 +2055,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
>  	if (cmd_flags & REQ_DISCARD) {
>  		/* complete ongoing async transfer before issuing discard */
>  		if (card->host->areq)
> -			mmc_blk_issue_rw_rq(mq, NULL);
> +			ret = mmc_blk_issue_rw_rq(mq, NULL);
> +		if (!ret)
> +			goto out;
>  		if (req->cmd_flags & REQ_SECURE)
>  			ret = mmc_blk_issue_secdiscard_rq(mq, req);
>  		else
> @@ -2063,7 +2065,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
>  	} else if (cmd_flags & REQ_FLUSH) {
>  		/* complete ongoing async transfer before issuing flush */
>  		if (card->host->areq)
> -			mmc_blk_issue_rw_rq(mq, NULL);
> +			ret = mmc_blk_issue_rw_rq(mq, NULL);
> +		if (!ret)
> +			goto out;
>  		ret = mmc_blk_issue_flush(mq, req);
>  	} else {
>  		if (!req && host->areq) {
> 


           reply	other threads:[~2015-12-28  8:45 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1451160642-26585-1-git-send-email-xerofoify@gmail.com>]

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=5680F5F9.9020207@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=chuanxiao.dong@intel.com \
    --cc=grundler@chromium.org \
    --cc=jonathanh@nvidia.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=lporzio@micron.com \
    --cc=sholi@nvidia.com \
    --cc=tklauser@distanz.ch \
    --cc=tomas.winkler@intel.com \
    --cc=ulf.hansson@linaro.org \
    --cc=xerofoify@gmail.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 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.