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

Brian Masney posted 2 patches 2 years ago
[PATCH v3 1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init
Posted by Brian Masney 2 years ago
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

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
Changes since v2
- None

Changes since v1
- Dropped code cleanup

 drivers/ufs/core/ufshcd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 129446775796..409d176542e1 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
 
 	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);
+		dev_err_probe(hba->dev, err,
+			      "%s: variant %s init failed err %d\n",
+			      __func__, ufshcd_get_var_name(hba), err);
 out:
 	return err;
 }
-- 
2.41.0
Re: [PATCH v3 1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init
Posted by Bart Van Assche 2 years ago
On 8/14/23 11:43, Brian Masney wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 129446775796..409d176542e1 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
>   
>   	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);
> +		dev_err_probe(hba->dev, err,
> +			      "%s: variant %s init failed err %d\n",
> +			      __func__, ufshcd_get_var_name(hba), err);
>   out:
>   	return err;
>   }

This opportunity could have been used to improve the grammar of the reported
error message. Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Re: [PATCH v3 1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init
Posted by Brian Masney 2 years ago
On Mon, Aug 14, 2023 at 12:31:31PM -0700, Bart Van Assche wrote:
> On 8/14/23 11:43, Brian Masney wrote:
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index 129446775796..409d176542e1 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
> >   	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);
> > +		dev_err_probe(hba->dev, err,
> > +			      "%s: variant %s init failed err %d\n",
> > +			      __func__, ufshcd_get_var_name(hba), err);
> >   out:
> >   	return err;
> >   }
> 
> This opportunity could have been used to improve the grammar of the reported
> error message. Anyway:

That's what I originally did in v1, however I was asked to split out the
cleanup into a different patch. Split out, I think the cleanup on it's
own isn't worth it's own patch, so that's why I dropped it.

https://lore.kernel.org/lkml/20230808142650.1713432-2-bmasney@redhat.com/

> Reviewed-by: Bart Van Assche <bvanassche@acm.org>

Thanks!

Brian
Re: [PATCH v3 1/2] scsi: ufs: core: convert to dev_err_probe() in hba_init
Posted by Bart Van Assche 2 years ago
On 8/14/23 14:18, Brian Masney wrote:
> On Mon, Aug 14, 2023 at 12:31:31PM -0700, Bart Van Assche wrote:
>> On 8/14/23 11:43, Brian Masney wrote:
>>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>>> index 129446775796..409d176542e1 100644
>>> --- a/drivers/ufs/core/ufshcd.c
>>> +++ b/drivers/ufs/core/ufshcd.c
>>> @@ -9235,8 +9235,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
>>>    	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);
>>> +		dev_err_probe(hba->dev, err,
>>> +			      "%s: variant %s init failed err %d\n",
>>> +			      __func__, ufshcd_get_var_name(hba), err);
>>>    out:
>>>    	return err;
>>>    }
>>
>> This opportunity could have been used to improve the grammar of the reported
>> error message. Anyway:
> 
> That's what I originally did in v1, however I was asked to split out the
> cleanup into a different patch. Split out, I think the cleanup on it's
> own isn't worth it's own patch, so that's why I dropped it.
> 
> https://lore.kernel.org/lkml/20230808142650.1713432-2-bmasney@redhat.com/

Changing an error message and introducing dev_err_probe() at the same time is
fine. I don't think that is what the reviewer complained about. The complaint
probably was about renaming 'err' into 'ret' and about changing 'goto out'
into 'return 0'?

Thanks,

Bart.