linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Halaney <ahalaney@redhat.com>
To: Chanwoo Lee <cw9316.lee@samsung.com>
Cc: mani@kernel.org, agross@kernel.org, andersson@kernel.org,
	 konrad.dybcio@linaro.org, jejb@linux.ibm.com,
	martin.petersen@oracle.com,  p.zabel@pengutronix.de,
	linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org,
	 linux-kernel@vger.kernel.org, grant.jung@samsung.com,
	jt77.jang@samsung.com,  dh0421.hwang@samsung.com,
	sh043.lee@samsung.com
Subject: Re: [PATCH] scsi: ufs: qcom: Re-fix for error handling
Date: Wed, 13 Dec 2023 11:17:18 -0600	[thread overview]
Message-ID: <m5wjp3yb3qpheyzgipekeagycboifqdpw54nquzqsftufap3yc@kxjwi4y63adj> (raw)
In-Reply-To: <20231213022500.9011-1-cw9316.lee@samsung.com>

On Wed, Dec 13, 2023 at 11:25:00AM +0900, Chanwoo Lee wrote:
> From: ChanWoo Lee <cw9316.lee@samsung.com>
> 
> I modified the code to handle errors.
> 
> The error handling code has been changed from the patch below.
> -'commit 031312dbc695 ("scsi: ufs: ufs-qcom: Remove unnecessary goto statements")'
> 
> What I have confirmed are three cases.
> 1) ufs_qcom_host_reset -> 'reset_control_deassert' error -> return 0;
> 2) ufs_qcom_clk_scale_notify -> 'ufs_qcom_clk_scale_up_/down_pre_change' error -> return 0;
> 3) ufs_qcom_init_lane_clks -> 'ufs_qcom_host_clk_get(tx_lane1_sync_clk)' error -> return 0;
> 
> It is unknown whether the above commit was intended to change error handling.
> However, if it is not an intended fix, a patch may be needed.

I think you're right, these were not intentionally changed. There's a
patch series in flight right now that cleans up some of this driver and
inadvertently tackles some of the problems below.

> 
> Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
> ---
>  drivers/ufs/host/ufs-qcom.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 96cb8b5b4e66..8a93d93ab08f 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -313,6 +313,8 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host)
>  
>  		err = ufs_qcom_host_clk_get(dev, "tx_lane1_sync_clk",
>  			&host->tx_l1_sync_clk, true);
> +		if (err)
> +			return err;

This patch cleans this up: https://lore.kernel.org/linux-arm-msm/20231208065902.11006-2-manivannan.sadhasivam@linaro.org/

>  	}
>  
>  	return 0;
> @@ -404,9 +406,11 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
>  	usleep_range(200, 210);
>  
>  	ret = reset_control_deassert(host->core_reset);
> -	if (ret)
> +	if (ret) {
>  		dev_err(hba->dev, "%s: core_reset deassert failed, err = %d\n",
>  				 __func__, ret);
> +		return ret;
> +	}

This patch cleans this up: https://lore.kernel.org/linux-arm-msm/20231208065902.11006-8-manivannan.sadhasivam@linaro.org/#t

>  
>  	usleep_range(1000, 1100);
>  
> @@ -415,7 +419,7 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
>  		hba->is_irq_enabled = true;
>  	}
>  
> -	return 0;
> +	return ret;

If I'm reading right returning ret is pointless here with your change
above (it already returns ret, and it is no longer updated right so the
only possible value here is 0?

>  }
>  
>  static u32 ufs_qcom_get_hs_gear(struct ufs_hba *hba)
> @@ -1535,7 +1539,7 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba,
>  		ufshcd_uic_hibern8_exit(hba);
>  	}
>  
> -	return 0;
> +	return err;
>  }

I think you could move this one up into the PRE_CHANGE block and leave
return 0 here? I believe this is the only case not yet covered by the
patch series I linked. Good catch!

>  
>  static void ufs_qcom_enable_test_bus(struct ufs_qcom_host *host)
> -- 
> 2.29.0
> 
> 


      reply	other threads:[~2023-12-13 17:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20231213022525epcas1p219483a7572a12394c5852cd53a367da4@epcas1p2.samsung.com>
2023-12-13  2:25 ` [PATCH] scsi: ufs: qcom: Re-fix for error handling Chanwoo Lee
2023-12-13 17:17   ` Andrew Halaney [this message]

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=m5wjp3yb3qpheyzgipekeagycboifqdpw54nquzqsftufap3yc@kxjwi4y63adj \
    --to=ahalaney@redhat.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=cw9316.lee@samsung.com \
    --cc=dh0421.hwang@samsung.com \
    --cc=grant.jung@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=jt77.jang@samsung.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=p.zabel@pengutronix.de \
    --cc=sh043.lee@samsung.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).