diff mbox series

power: supply: max77650: Make max77650_charger_disable() return void

Message ID 20230210212528.179627-1-u.kleine-koenig@pengutronix.de
State Accepted
Commit a915dfd099b7e324de60fcbc29ef373479c5f69e
Headers show
Series power: supply: max77650: Make max77650_charger_disable() return void | expand

Commit Message

Uwe Kleine-König Feb. 10, 2023, 9:25 p.m. UTC
The return value of max77650_charger_disable() is ignored by all but one
caller. That one caller propagates the error code in the platform driver's
remove function. The only effect of that is that the driver core emits
a generic error message (but still removes the device). As
max77650_charger_disable() already emits an error message, this can better
be changed to return zero.

This is a preparation for making struct platform_driver::remove return
void, too.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/power/supply/max77650-charger.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


base-commit: 4f72a263e162938de26866b862ed6015f5725946

Comments

Bartosz Golaszewski Feb. 13, 2023, 1:53 p.m. UTC | #1
On Fri, Feb 10, 2023 at 10:25 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> The return value of max77650_charger_disable() is ignored by all but one
> caller. That one caller propagates the error code in the platform driver's
> remove function. The only effect of that is that the driver core emits
> a generic error message (but still removes the device). As
> max77650_charger_disable() already emits an error message, this can better
> be changed to return zero.
>
> This is a preparation for making struct platform_driver::remove return
> void, too.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/power/supply/max77650-charger.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/power/supply/max77650-charger.c b/drivers/power/supply/max77650-charger.c
> index d913428bedc0..e8c25da40ab2 100644
> --- a/drivers/power/supply/max77650-charger.c
> +++ b/drivers/power/supply/max77650-charger.c
> @@ -141,7 +141,7 @@ static int max77650_charger_enable(struct max77650_charger_data *chg)
>         return rv;
>  }
>
> -static int max77650_charger_disable(struct max77650_charger_data *chg)
> +static void max77650_charger_disable(struct max77650_charger_data *chg)
>  {
>         int rv;
>
> @@ -151,8 +151,6 @@ static int max77650_charger_disable(struct max77650_charger_data *chg)
>                                 MAX77650_CHARGER_DISABLED);
>         if (rv)
>                 dev_err(chg->dev, "unable to disable the charger: %d\n", rv);
> -
> -       return rv;
>  }
>
>  static irqreturn_t max77650_charger_check_status(int irq, void *data)
> @@ -351,7 +349,9 @@ static int max77650_charger_remove(struct platform_device *pdev)
>  {
>         struct max77650_charger_data *chg = platform_get_drvdata(pdev);
>
> -       return max77650_charger_disable(chg);
> +       max77650_charger_disable(chg);
> +
> +       return 0;
>  }
>
>  static const struct of_device_id max77650_charger_of_match[] = {
>
> base-commit: 4f72a263e162938de26866b862ed6015f5725946
> --
> 2.39.0
>

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Sebastian Reichel Feb. 13, 2023, 8:22 p.m. UTC | #2
Hi,

On Mon, Feb 13, 2023 at 02:53:07PM +0100, Bartosz Golaszewski wrote:
> On Fri, Feb 10, 2023 at 10:25 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > The return value of max77650_charger_disable() is ignored by all but one
> > caller. That one caller propagates the error code in the platform driver's
> > remove function. The only effect of that is that the driver core emits
> > a generic error message (but still removes the device). As
> > max77650_charger_disable() already emits an error message, this can better
> > be changed to return zero.
> >
> > This is a preparation for making struct platform_driver::remove return
> > void, too.
> >
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/power/supply/max77650-charger.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/power/supply/max77650-charger.c b/drivers/power/supply/max77650-charger.c
> > index d913428bedc0..e8c25da40ab2 100644
> > --- a/drivers/power/supply/max77650-charger.c
> > +++ b/drivers/power/supply/max77650-charger.c
> > @@ -141,7 +141,7 @@ static int max77650_charger_enable(struct max77650_charger_data *chg)
> >         return rv;
> >  }
> >
> > -static int max77650_charger_disable(struct max77650_charger_data *chg)
> > +static void max77650_charger_disable(struct max77650_charger_data *chg)
> >  {
> >         int rv;
> >
> > @@ -151,8 +151,6 @@ static int max77650_charger_disable(struct max77650_charger_data *chg)
> >                                 MAX77650_CHARGER_DISABLED);
> >         if (rv)
> >                 dev_err(chg->dev, "unable to disable the charger: %d\n", rv);
> > -
> > -       return rv;
> >  }
> >
> >  static irqreturn_t max77650_charger_check_status(int irq, void *data)
> > @@ -351,7 +349,9 @@ static int max77650_charger_remove(struct platform_device *pdev)
> >  {
> >         struct max77650_charger_data *chg = platform_get_drvdata(pdev);
> >
> > -       return max77650_charger_disable(chg);
> > +       max77650_charger_disable(chg);
> > +
> > +       return 0;
> >  }
> >
> >  static const struct of_device_id max77650_charger_of_match[] = {
> >
> > base-commit: 4f72a263e162938de26866b862ed6015f5725946
> > --
> > 2.39.0
> >
> 
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Thanks, queued.

-- Sebastian
diff mbox series

Patch

diff --git a/drivers/power/supply/max77650-charger.c b/drivers/power/supply/max77650-charger.c
index d913428bedc0..e8c25da40ab2 100644
--- a/drivers/power/supply/max77650-charger.c
+++ b/drivers/power/supply/max77650-charger.c
@@ -141,7 +141,7 @@  static int max77650_charger_enable(struct max77650_charger_data *chg)
 	return rv;
 }
 
-static int max77650_charger_disable(struct max77650_charger_data *chg)
+static void max77650_charger_disable(struct max77650_charger_data *chg)
 {
 	int rv;
 
@@ -151,8 +151,6 @@  static int max77650_charger_disable(struct max77650_charger_data *chg)
 				MAX77650_CHARGER_DISABLED);
 	if (rv)
 		dev_err(chg->dev, "unable to disable the charger: %d\n", rv);
-
-	return rv;
 }
 
 static irqreturn_t max77650_charger_check_status(int irq, void *data)
@@ -351,7 +349,9 @@  static int max77650_charger_remove(struct platform_device *pdev)
 {
 	struct max77650_charger_data *chg = platform_get_drvdata(pdev);
 
-	return max77650_charger_disable(chg);
+	max77650_charger_disable(chg);
+
+	return 0;
 }
 
 static const struct of_device_id max77650_charger_of_match[] = {