Message ID | 20220113101430.12869-2-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mfd: twlx030: i2c remove callback cleanup | expand |
On Thu, 13 Jan 2022, Uwe Kleine-König wrote: > This function returns 0 unconditionally, so there is no benefit in > returning a value at all and make the caller do error checking. > > Also the caller (twl_remove()) cannot do anything sensible with an error > code. Passing it up the call stack isn't a good option because the i2c core > ignores error codes (apart from emitting an error message). > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > --- > drivers/mfd/twl-core.c | 4 ++-- > drivers/mfd/twl-core.h | 2 +- > drivers/mfd/twl6030-irq.c | 3 +-- > 3 files changed, 4 insertions(+), 5 deletions(-) Applied, thanks.
Hello Lee, On Thu, Apr 28, 2022 at 05:24:21PM +0100, Lee Jones wrote: > On Thu, 13 Jan 2022, Uwe Kleine-König wrote: > > > This function returns 0 unconditionally, so there is no benefit in > > returning a value at all and make the caller do error checking. > > > > Also the caller (twl_remove()) cannot do anything sensible with an error > > code. Passing it up the call stack isn't a good option because the i2c core > > ignores error codes (apart from emitting an error message). > > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > --- > > drivers/mfd/twl-core.c | 4 ++-- > > drivers/mfd/twl-core.h | 2 +- > > drivers/mfd/twl6030-irq.c | 3 +-- > > 3 files changed, 4 insertions(+), 5 deletions(-) > > Applied, thanks. I would have expected these to appear in next since you wrote to have applied this series. But they have not though your claim to have applied them is over three weeks old now?! :-\ Best regards Uwe
On Mon, 23 May 2022, Uwe Kleine-König wrote: > Hello Lee, > > On Thu, Apr 28, 2022 at 05:24:21PM +0100, Lee Jones wrote: > > On Thu, 13 Jan 2022, Uwe Kleine-König wrote: > > > > > This function returns 0 unconditionally, so there is no benefit in > > > returning a value at all and make the caller do error checking. > > > > > > Also the caller (twl_remove()) cannot do anything sensible with an error > > > code. Passing it up the call stack isn't a good option because the i2c core > > > ignores error codes (apart from emitting an error message). > > > > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > > --- > > > drivers/mfd/twl-core.c | 4 ++-- > > > drivers/mfd/twl-core.h | 2 +- > > > drivers/mfd/twl6030-irq.c | 3 +-- > > > 3 files changed, 4 insertions(+), 5 deletions(-) > > > > Applied, thanks. > > I would have expected these to appear in next since you wrote to have > applied this series. But they have not though your claim to have applied > them is over three weeks old now?! :-\ Don't worry. They're both applied and will be in v5.19.
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 289b556dede2..d4194faf1cc3 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -1036,12 +1036,12 @@ static void clocks_init(struct device *dev, static int twl_remove(struct i2c_client *client) { unsigned i, num_slaves; - int status; + int status = 0; if (twl_class_is_4030()) status = twl4030_exit_irq(); else - status = twl6030_exit_irq(); + twl6030_exit_irq(); if (status < 0) return status; diff --git a/drivers/mfd/twl-core.h b/drivers/mfd/twl-core.h index 6f96c2009a9f..1b916d2e8752 100644 --- a/drivers/mfd/twl-core.h +++ b/drivers/mfd/twl-core.h @@ -3,7 +3,7 @@ #define __TWL_CORE_H__ extern int twl6030_init_irq(struct device *dev, int irq_num); -extern int twl6030_exit_irq(void); +extern void twl6030_exit_irq(void); extern int twl4030_init_irq(struct device *dev, int irq_num); extern int twl4030_exit_irq(void); extern int twl4030_init_chip_irq(const char *chip); diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 97af6c2a6007..3c03681c124c 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -438,7 +438,7 @@ int twl6030_init_irq(struct device *dev, int irq_num) return status; } -int twl6030_exit_irq(void) +void twl6030_exit_irq(void) { if (twl6030_irq && twl6030_irq->twl_irq) { unregister_pm_notifier(&twl6030_irq->pm_nb); @@ -453,6 +453,5 @@ int twl6030_exit_irq(void) * in this module. */ } - return 0; }
This function returns 0 unconditionally, so there is no benefit in returning a value at all and make the caller do error checking. Also the caller (twl_remove()) cannot do anything sensible with an error code. Passing it up the call stack isn't a good option because the i2c core ignores error codes (apart from emitting an error message). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/mfd/twl-core.c | 4 ++-- drivers/mfd/twl-core.h | 2 +- drivers/mfd/twl6030-irq.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-)