diff mbox series

[1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init

Message ID 20230808142650.1713432-2-bmasney@redhat.com (mailing list archive)
State Superseded
Headers show
Series scsi: ufs: convert probe to use dev_err_probe() | expand

Commit Message

Brian Masney Aug. 8, 2023, 2:26 p.m. UTC
Convert ufshcd_variant_hba_init() over to use dev_err_probe() to avoid
log messages like the following on bootup:

    ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init
        failed err -517

While changes are being made here, let's go ahead and clean up the rest
of that function.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/ufs/core/ufshcd.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Comments

Hugo Villeneuve Aug. 8, 2023, 8:29 p.m. UTC | #1
On Tue,  8 Aug 2023 10:26:49 -0400
Brian Masney <bmasney@redhat.com> wrote:

> Convert ufshcd_variant_hba_init() over to use dev_err_probe() to avoid
> log messages like the following on bootup:
> 
>     ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init
>         failed err -517
> 
> While changes are being made here, let's go ahead and clean up the rest
> of that function.

Hi,
you should not combine code cleanup and fixes/improvements in the same
patch, split them.

Hugo Villeneuve


> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---
>  drivers/ufs/core/ufshcd.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 129446775796..90d87cf5e25e 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9228,17 +9228,18 @@ static int ufshcd_init_clocks(struct ufs_hba *hba)
>  
>  static int ufshcd_variant_hba_init(struct ufs_hba *hba)
>  {
> -	int err = 0;
> +	int ret;
>  
>  	if (!hba->vops)
> -		goto out;
> +		return 0;
>  
> -	err = ufshcd_vops_init(hba);
> -	if (err)
> -		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
> -			__func__, ufshcd_get_var_name(hba), err);
> -out:
> -	return err;
> +	ret = ufshcd_vops_init(hba);
> +	if (ret)
> +		dev_err_probe(hba->dev, ret,
> +			      "%s: variant %s init failed with error %d\n",
> +			      __func__, ufshcd_get_var_name(hba), ret);
> +
> +	return ret;
>  }
>  
>  static void ufshcd_variant_hba_exit(struct ufs_hba *hba)
> -- 
> 2.41.0
>
Brian Masney Aug. 9, 2023, 6:56 p.m. UTC | #2
On Tue, Aug 08, 2023 at 04:29:29PM -0400, Hugo Villeneuve wrote:
> On Tue,  8 Aug 2023 10:26:49 -0400
> Brian Masney <bmasney@redhat.com> wrote:
> 
> > Convert ufshcd_variant_hba_init() over to use dev_err_probe() to avoid
> > log messages like the following on bootup:
> > 
> >     ufshcd-qcom 1d84000.ufs: ufshcd_variant_hba_init: variant qcom init
> >         failed err -517
> > 
> > While changes are being made here, let's go ahead and clean up the rest
> > of that function.
> 
> Hi,
> you should not combine code cleanup and fixes/improvements in the same
> patch, split them.

This is a pretty simple patch as is, and split up the code clean up is
not very useful on its own. I'll just skip doing the code cleanup and
only post the dev_err_probe() change in v2.

Brian
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 129446775796..90d87cf5e25e 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9228,17 +9228,18 @@  static int ufshcd_init_clocks(struct ufs_hba *hba)
 
 static int ufshcd_variant_hba_init(struct ufs_hba *hba)
 {
-	int err = 0;
+	int ret;
 
 	if (!hba->vops)
-		goto out;
+		return 0;
 
-	err = ufshcd_vops_init(hba);
-	if (err)
-		dev_err(hba->dev, "%s: variant %s init failed err %d\n",
-			__func__, ufshcd_get_var_name(hba), err);
-out:
-	return err;
+	ret = ufshcd_vops_init(hba);
+	if (ret)
+		dev_err_probe(hba->dev, ret,
+			      "%s: variant %s init failed with error %d\n",
+			      __func__, ufshcd_get_var_name(hba), ret);
+
+	return ret;
 }
 
 static void ufshcd_variant_hba_exit(struct ufs_hba *hba)