diff mbox series

[v2] mtd: Avoid printing error messages on probe deferrals

Message ID 20230307192506.439532-1-miquel.raynal@bootlin.com
State Accepted
Headers show
Series [v2] mtd: Avoid printing error messages on probe deferrals | expand

Commit Message

Miquel Raynal March 7, 2023, 7:25 p.m. UTC
There is no reason to complain about probe errors in case of deferrals.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Changes in v2:
* Use of dev_err_probe().

 drivers/mtd/mtdcore.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Michael Walle March 7, 2023, 8:35 p.m. UTC | #1
Am 2023-03-07 20:25, schrieb Miquel Raynal:
> There is no reason to complain about probe errors in case of deferrals.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> Changes in v2:
> * Use of dev_err_probe().
> 
>  drivers/mtd/mtdcore.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 0feacb9fbdac..e4e102585021 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
>  	mtd->nvmem = nvmem_register(&config);
>  	if (IS_ERR(mtd->nvmem)) {
>  		/* Just ignore if there is no NVMEM support in the kernel */
> -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
> +		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
>  			mtd->nvmem = NULL;
> -		} else {
> -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
> -			return PTR_ERR(mtd->nvmem);
> -		}
> +		else
> +			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),

There is a '\t' after the ",".

With that fixed,
Reviewed-by: Michael Walle <michael@walle.cc>

-michael
Miquel Raynal March 8, 2023, 1:54 p.m. UTC | #2
Hi Michael,

michael@walle.cc wrote on Tue, 07 Mar 2023 21:35:05 +0100:

> Am 2023-03-07 20:25, schrieb Miquel Raynal:
> > There is no reason to complain about probe errors in case of deferrals.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> > Changes in v2:
> > * Use of dev_err_probe().
> > 
> >  drivers/mtd/mtdcore.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> > index 0feacb9fbdac..e4e102585021 100644
> > --- a/drivers/mtd/mtdcore.c
> > +++ b/drivers/mtd/mtdcore.c
> > @@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
> >  	mtd->nvmem = nvmem_register(&config);
> >  	if (IS_ERR(mtd->nvmem)) {
> >  		/* Just ignore if there is no NVMEM support in the kernel */
> > -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
> > +		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
> >  			mtd->nvmem = NULL;
> > -		} else {
> > -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
> > -			return PTR_ERR(mtd->nvmem);
> > -		}
> > +		else
> > +			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),  
> 
> There is a '\t' after the ",".

Mmmh, didn't notice, will fix it while applying.

> 
> With that fixed,
> Reviewed-by: Michael Walle <michael@walle.cc>
> 
> -michael


Thanks,
Miquèl
Rafał Miłecki March 20, 2023, 11:17 a.m. UTC | #3
On 7.03.2023 20:25, Miquel Raynal wrote:
> There is no reason to complain about probe errors in case of deferrals.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> Changes in v2:
> * Use of dev_err_probe().
> 
>   drivers/mtd/mtdcore.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 0feacb9fbdac..e4e102585021 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
>   	mtd->nvmem = nvmem_register(&config);
>   	if (IS_ERR(mtd->nvmem)) {
>   		/* Just ignore if there is no NVMEM support in the kernel */
> -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
> +		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
>   			mtd->nvmem = NULL;
> -		} else {
> -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
> -			return PTR_ERR(mtd->nvmem);
> -		}
> +		else
> +			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),
> +					     "Failed to register NVMEM device\n");

Even one more improvement request possibility and request from me:
"Failed to register NVMEM device: %d\n"

>   	}
>   
>   	return 0;
Miquel Raynal March 20, 2023, 11:23 a.m. UTC | #4
Hi Rafał,

zajec5@gmail.com wrote on Mon, 20 Mar 2023 12:17:12 +0100:

> On 7.03.2023 20:25, Miquel Raynal wrote:
> > There is no reason to complain about probe errors in case of deferrals.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> > Changes in v2:
> > * Use of dev_err_probe().
> > 
> >   drivers/mtd/mtdcore.c | 9 ++++-----
> >   1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> > index 0feacb9fbdac..e4e102585021 100644
> > --- a/drivers/mtd/mtdcore.c
> > +++ b/drivers/mtd/mtdcore.c
> > @@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
> >   	mtd->nvmem = nvmem_register(&config);
> >   	if (IS_ERR(mtd->nvmem)) {
> >   		/* Just ignore if there is no NVMEM support in the kernel */
> > -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
> > +		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
> >   			mtd->nvmem = NULL;
> > -		} else {
> > -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
> > -			return PTR_ERR(mtd->nvmem);
> > -		}
> > +		else
> > +			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),
> > +					     "Failed to register NVMEM device\n");  
> 
> Even one more improvement request possibility and request from me:
> "Failed to register NVMEM device: %d\n"

I get the request, but as I was saying in the other thread, isn't this
already handled?

https://elixir.bootlin.com/linux/latest/source/drivers/base/core.c#L4961

Thanks,
Miquèl
Rafał Miłecki March 21, 2023, 12:35 p.m. UTC | #5
On 20.03.2023 12:23, Miquel Raynal wrote:
> zajec5@gmail.com wrote on Mon, 20 Mar 2023 12:17:12 +0100:
> 
>> On 7.03.2023 20:25, Miquel Raynal wrote:
>>> There is no reason to complain about probe errors in case of deferrals.
>>>
>>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>> ---
>>> Changes in v2:
>>> * Use of dev_err_probe().
>>>
>>>    drivers/mtd/mtdcore.c | 9 ++++-----
>>>    1 file changed, 4 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
>>> index 0feacb9fbdac..e4e102585021 100644
>>> --- a/drivers/mtd/mtdcore.c
>>> +++ b/drivers/mtd/mtdcore.c
>>> @@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
>>>    	mtd->nvmem = nvmem_register(&config);
>>>    	if (IS_ERR(mtd->nvmem)) {
>>>    		/* Just ignore if there is no NVMEM support in the kernel */
>>> -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
>>> +		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
>>>    			mtd->nvmem = NULL;
>>> -		} else {
>>> -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
>>> -			return PTR_ERR(mtd->nvmem);
>>> -		}
>>> +		else
>>> +			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),
>>> +					     "Failed to register NVMEM device\n");
>>
>> Even one more improvement request possibility and request from me:
>> "Failed to register NVMEM device: %d\n"
> 
> I get the request, but as I was saying in the other thread, isn't this
> already handled?
> 
> https://elixir.bootlin.com/linux/latest/source/drivers/base/core.c#L4961

Oh, looks good, ignore my previous request.
Rafał Miłecki March 21, 2023, 12:37 p.m. UTC | #6
On 7.03.2023 20:25, Miquel Raynal wrote:
> There is no reason to complain about probe errors in case of deferrals.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Acked-by: Rafał Miłecki <rafal@milecki.pl>

> ---
> Changes in v2:
> * Use of dev_err_probe().
> 
>   drivers/mtd/mtdcore.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 0feacb9fbdac..e4e102585021 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -536,12 +536,11 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
>   	mtd->nvmem = nvmem_register(&config);
>   	if (IS_ERR(mtd->nvmem)) {
>   		/* Just ignore if there is no NVMEM support in the kernel */
> -		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
> +		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
>   			mtd->nvmem = NULL;
> -		} else {
> -			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
> -			return PTR_ERR(mtd->nvmem);
> -		}
> +		else
> +			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),
> +					     "Failed to register NVMEM device\n");
>   	}
>   
>   	return 0;
Miquel Raynal March 22, 2023, 4:08 p.m. UTC | #7
On Tue, 2023-03-07 at 19:25:06 UTC, Miquel Raynal wrote:
> There is no reason to complain about probe errors in case of deferrals.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Reviewed-by: Michael Walle <michael@walle.cc>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 0feacb9fbdac..e4e102585021 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -536,12 +536,11 @@  static int mtd_nvmem_add(struct mtd_info *mtd)
 	mtd->nvmem = nvmem_register(&config);
 	if (IS_ERR(mtd->nvmem)) {
 		/* Just ignore if there is no NVMEM support in the kernel */
-		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
+		if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP)
 			mtd->nvmem = NULL;
-		} else {
-			dev_err(&mtd->dev, "Failed to register NVMEM device\n");
-			return PTR_ERR(mtd->nvmem);
-		}
+		else
+			return dev_err_probe(&mtd->dev,	PTR_ERR(mtd->nvmem),
+					     "Failed to register NVMEM device\n");
 	}
 
 	return 0;