linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bean Huo <huobean@gmail.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>, Can Guo <cang@codeaurora.org>,
	Asutosh Das <asutoshd@codeaurora.org>,
	Stanley Chu <stanley.chu@mediatek.com>
Subject: Re: [PATCH] scsi: ufs: Fix incorrect ufshcd_state after ufshcd_reset_and_restore()
Date: Mon, 01 Mar 2021 21:46:40 +0100	[thread overview]
Message-ID: <abbf014dfa28f3a8690c14a0ffad32ce24fa35aa.camel@gmail.com> (raw)
In-Reply-To: <20210301191940.15247-1-adrian.hunter@intel.com>

On Mon, 2021-03-01 at 21:19 +0200, Adrian Hunter wrote:
> If ufshcd_probe_hba() fails it sets ufshcd_state to
> UFSHCD_STATE_ERROR,
> however, if it is called again, as it is within a loop in
> ufshcd_reset_and_restore(), and succeeds, then it will not set the
> state
> back to UFSHCD_STATE_OPERATIONAL unless the state was
> UFSHCD_STATE_RESET.
> 
> That can result in the state being UFSHCD_STATE_ERROR even though
> ufshcd_reset_and_restore() is successful and returns zero.
> 
> Fix by initializing the state to UFSHCD_STATE_RESET in the start of
> each
> loop in ufshcd_reset_and_restore().  If there is an error,
> ufshcd_reset_and_restore() will change the state to
> UFSHCD_STATE_ERROR,
> otherwise ufshcd_probe_hba() will have set the state appropriately.
> 
> Fixes: 4db7a2360597 ("scsi: ufs: Fix concurrency of error handler and
> other error recovery paths")
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

We used to directly set hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL at
the beginning of ufshcd_probe_hba(), and didn't have checkup if (hba-
>ufshcd_state == UFSHCD_STATE_RESET). Remove this checkup, also works,
but in This loop, it it better that, before going to reset flow,
ufshcd_state should be set UFSHCD_STATE_RESET.


Reviewed-by: Bean Huo <beanhuo@micron.com>


  reply	other threads:[~2021-03-02  7:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 19:19 [PATCH] scsi: ufs: Fix incorrect ufshcd_state after ufshcd_reset_and_restore() Adrian Hunter
2021-03-01 20:46 ` Bean Huo [this message]
2021-03-01 23:54 ` Asutosh Das
2021-03-02  7:01 ` Avri Altman
2021-03-02  8:14   ` Adrian Hunter
2021-03-02 13:04     ` Bean Huo
2021-03-03 10:19     ` Can Guo
2021-03-03 10:05 ` Can Guo
2021-03-04  4:16 ` 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=abbf014dfa28f3a8690c14a0ffad32ce24fa35aa.camel@gmail.com \
    --to=huobean@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=cang@codeaurora.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stanley.chu@mediatek.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).