[PATCH 3/6] iio: imu: inv_icm42600: Remove redundant error msg on regulator_disable()

Sean Nyekjaer posted 6 patches 3 months ago
There is a newer version of this series
[PATCH 3/6] iio: imu: inv_icm42600: Remove redundant error msg on regulator_disable()
Posted by Sean Nyekjaer 3 months ago
The regulator framework already emits an error message when
regulator_disable() fails, making the local dev_err() redundant.
Remove the duplicate message to avoid cluttering the kernel log
with the same error twice.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index 35f7c66d77790829a739d2c54ba77e53903a9297..55a29b1e2b11355598b0ede7af22857aed3ae134 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -700,12 +700,8 @@ static int inv_icm42600_enable_regulator_vddio(struct inv_icm42600_state *st)
 static void inv_icm42600_disable_vddio_reg(void *_data)
 {
 	struct inv_icm42600_state *st = _data;
-	const struct device *dev = regmap_get_device(st->map);
-	int ret;
 
-	ret = regulator_disable(st->vddio_supply);
-	if (ret)
-		dev_err(dev, "failed to disable vddio error %d\n", ret);
+	regulator_disable(st->vddio_supply);
 }
 
 static void inv_icm42600_disable_pm(void *_data)

-- 
2.50.0
Re: [PATCH 3/6] iio: imu: inv_icm42600: Remove redundant error msg on regulator_disable()
Posted by Jonathan Cameron 2 months, 3 weeks ago
On Wed, 09 Jul 2025 14:35:11 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> The regulator framework already emits an error message when
> regulator_disable() fails, making the local dev_err() redundant.
> Remove the duplicate message to avoid cluttering the kernel log
> with the same error twice.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
>  drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> index 35f7c66d77790829a739d2c54ba77e53903a9297..55a29b1e2b11355598b0ede7af22857aed3ae134 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> @@ -700,12 +700,8 @@ static int inv_icm42600_enable_regulator_vddio(struct inv_icm42600_state *st)
>  static void inv_icm42600_disable_vddio_reg(void *_data)
>  {
>  	struct inv_icm42600_state *st = _data;
> -	const struct device *dev = regmap_get_device(st->map);
> -	int ret;
>  
> -	ret = regulator_disable(st->vddio_supply);
> -	if (ret)
> -		dev_err(dev, "failed to disable vddio error %d\n", ret);

Dropping this message (which is sensible) reinforces my lack of warm
fuzzy feelings about patch 1.  I'd definitely leave those other calls
alone and keep this as just a tight wrapper around st.  Note though that
can just pass the regulator as the parameter to the devm_add_action_or_reset()
and simplify this a bit more now you don't need to get to the dev.

> +	regulator_disable(st->vddio_supply);
>  }
>  
>  static void inv_icm42600_disable_pm(void *_data)
>
Re: [PATCH 3/6] iio: imu: inv_icm42600: Remove redundant error msg on regulator_disable()
Posted by Andy Shevchenko 2 months, 4 weeks ago
On Wed, Jul 09, 2025 at 02:35:11PM +0200, Sean Nyekjaer wrote:
> The regulator framework already emits an error message when
> regulator_disable() fails, making the local dev_err() redundant.
> Remove the duplicate message to avoid cluttering the kernel log
> with the same error twice.

To me this sounds like a potential backporting material as it might full
the logs (in case the module probed-removed zillion of time. Hence,
I would put it to be the first patch in the series (yes, it will involve
to fix something that you are removing in the following change, but still).

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 3/6] iio: imu: inv_icm42600: Remove redundant error msg on regulator_disable()
Posted by Sean Nyekjaer 2 months, 4 weeks ago
On Thu, Jul 10, 2025 at 12:03:26PM +0100, Andy Shevchenko wrote:
> On Wed, Jul 09, 2025 at 02:35:11PM +0200, Sean Nyekjaer wrote:
> > The regulator framework already emits an error message when
> > regulator_disable() fails, making the local dev_err() redundant.
> > Remove the duplicate message to avoid cluttering the kernel log
> > with the same error twice.
> 
> To me this sounds like a potential backporting material as it might full
> the logs (in case the module probed-removed zillion of time. Hence,
> I would put it to be the first patch in the series (yes, it will involve
> to fix something that you are removing in the following change, but still).

I have never seen this printed, so I don't think it's a huge issue.
But it's quite easy to add a Fixes tag if prefered.

> 
> --
> With Best Regards,
> Andy Shevchenko
> 
> 

/Sean
Re: [PATCH 3/6] iio: imu: inv_icm42600: Remove redundant error msg on regulator_disable()
Posted by Andy Shevchenko 2 months, 4 weeks ago
On Thu, Jul 10, 2025 at 10:47:08AM +0000, Sean Nyekjaer wrote:
> On Thu, Jul 10, 2025 at 12:03:26PM +0100, Andy Shevchenko wrote:
> > On Wed, Jul 09, 2025 at 02:35:11PM +0200, Sean Nyekjaer wrote:
> > > The regulator framework already emits an error message when
> > > regulator_disable() fails, making the local dev_err() redundant.
> > > Remove the duplicate message to avoid cluttering the kernel log
> > > with the same error twice.
> > 
> > To me this sounds like a potential backporting material as it might full
> > the logs (in case the module probed-removed zillion of time. Hence,
> > I would put it to be the first patch in the series (yes, it will involve
> > to fix something that you are removing in the following change, but still).
> 
> I have never seen this printed, so I don't think it's a huge issue.
> But it's quite easy to add a Fixes tag if prefered.

Or move it to the end and explain in cover letter that this doesn't fix
(apparently) any problem IRL.

-- 
With Best Regards,
Andy Shevchenko