linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>,
	Aymen Qader <qader.aymen@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rts5208: add a missing check for the status of command sending
Date: Thu, 20 Dec 2018 12:09:21 +0300	[thread overview]
Message-ID: <20181220090921.GP19692@kadam> (raw)
In-Reply-To: <20181220075704.40732-1-kjlu@umn.edu>

On Thu, Dec 20, 2018 at 01:57:01AM -0600, Kangjie Lu wrote:
> ms_send_cmd() may fail. The fix checks the return value of it, and if it
> fails, returns the error "STATUS_FAIL" upstream.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>  drivers/staging/rts5208/ms.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
> index f53adf15c685..5a9e562465e9 100644
> --- a/drivers/staging/rts5208/ms.c
> +++ b/drivers/staging/rts5208/ms.c
> @@ -2731,7 +2731,9 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb,
>  		}
>  
>  		if (val & MS_INT_BREQ)

You would need to add a curly brace here.


> -			ms_send_cmd(chip, PRO_STOP, WAIT_INT);
> +			retval = ms_send_cmd(chip, PRO_STOP, WAIT_INT);
> +			if (retval != STATUS_SUCCESS)
> +				return STATUS_FAIL;

You can't overwrite "retval".  We already had an error code save there
but now you're changing to STATUS_SUCCESS.

Anyway, I think the original error handling is probably correct and we
should leave it as-is.  We're already trying to handle an error
situation by resetting stuff.  Then if we get another error while we
take these extreme measures to recover, we shouldn't give up.  We should
just keep on trying to reset instead of returning early.

regards,
dan carpenter


  reply	other threads:[~2018-12-20  9:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  7:57 [PATCH] rts5208: add a missing check for the status of command sending Kangjie Lu
2018-12-20  9:09 ` Dan Carpenter [this message]
2018-12-20  9:27 ` Dan Carpenter
2018-12-20 17:31 ` kbuild test robot

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=20181220090921.GP19692@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=arnd@arndb.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=qader.aymen@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 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).