[PATCH 1/1] ufs: core: add fatal errors check for LINERESET

Bart Van Assche bvanassche at acm.org
Fri May 23 09:14:17 PDT 2025


On 5/23/25 3:10 AM, naomi.chu at mediatek.com wrote:
> +static bool ufshcd_is_linereset_fatal(struct ufs_hba *hba)
> +{
> +	bool needs_reset = true;
> +	unsigned long flags;
> +	int err;
> +
> +	spin_lock_irqsave(hba->host->host_lock, flags);
> +
> +	if (ufshcd_is_saved_err_fatal(hba)) {
> +		spin_unlock_irqrestore(hba->host->host_lock, flags);
> +		goto out;
> +	}
> +
> +	/*
> +	 * Wait for 100ms to ensure the PA_INIT flow is complete,
> +	 * and check for PA_INIT_ERR or other fatal errors.
> +	 */
> +	spin_unlock_irqrestore(hba->host->host_lock, flags);

Please use scoped_guard(spinlock_irqsave) instead of calling 
spin_lock_irqsave() and spin_unlock_irqrestore() directly.

 > +	msleep(100);

Can ufshcd_is_linereset_fatal() be called from IRQ context? If so,
calling msleep() is not allowed. If it can't be called from IRQ
context, saving and restoring 'flags' is not necessary.

Bart.



More information about the Linux-mediatek mailing list